Skip to content

Environmental variables at compile time not available #685

Open
@KamilLelonek

Description

Image: Elixir

Code that fails the build:

config :my_app,
  fcm_batch_size: "FCM_BATCH_SIZE" |> System.get_env() |> String.to_integer()

Error:

Compiling application :
  ✓ Starting docker container
  ✓ Preparing environment for compile
  ! Compiling code
    - Cleaning up any previous releases...
    - Copying code...
    - Compiling mix dependencies :
      ** (ArgumentError) argument error
          :erlang.binary_to_integer(nil)
          (stdlib) erl_eval.erl:677: :erl_eval.do_apply/6
          (stdlib) erl_eval.erl:885: :erl_eval.expr_list/6
          (stdlib) erl_eval.erl:240: :erl_eval.expr/5
          (stdlib) erl_eval.erl:232: :erl_eval.expr/5
          (stdlib) erl_eval.erl:233: :erl_eval.expr/5
          (stdlib) erl_eval.erl:885: :erl_eval.expr_list/6
          (stdlib) erl_eval.erl:408: :erl_eval.expr/5

    ! FAILED TO COMPILE APP !

    Exit
     1

    Command
     su - gonano -c "cd /opt/nanobox/engine/bin; export PATH=\"/data/sbin:/data/bin:/opt/gonano/sbin:/opt/gonano/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\"; export CODE_DIR=\"/app\"; export DATA_DIR=\"/data\"; export APP_DIR=\"/mnt/app\"; export CACHE_DIR=\"/mnt/cache\"; export ETC_DIR=\"/data/etc\"; export ENV_DIR=\"/data/etc/env.d\"; export CONFIG_RUNTIME_TYPE=\"string\"; export CONFIG_RUNTIME_VALUE=\"'elixir-1.7'\"; export CONFIG_ERLANG_RUNTIME_TYPE=\"string\"; export CONFIG_ERLANG_RUNTIME_VALUE=\"'erlang-21'\"; export CONFIG_NODES=\"runtime,erlang_runtime\"; stdbuf -o0 /opt/nanobox/engine/bin/compile '{\"code_dir\":\"/app\",\"data_dir\":\"/data\",\"app_dir\":\"/mnt/app\",\"cache_dir\":\"/mnt/cache/app\",\"etc_dir\":\"/data/etc\",\"env_dir\":\"/data/etc/env.d\",\"config\":{\"erlang_runtime\":\"erlang-21\",\"runtime\":\"elixir-1.7\"}}'"

    Output
     - Compiling mix dependencies :
       ** (ArgumentError) argument error
           :erlang.binary_to_integer(nil)
           (stdlib) erl_eval.erl:677: :erl_eval.do_apply/6
           (stdlib) erl_eval.erl:885: :erl_eval.expr_list/6
           (stdlib) erl_eval.erl:240: :erl_eval.expr/5
           (stdlib) erl_eval.erl:232: :erl_eval.expr/5
           (stdlib) erl_eval.erl:233: :erl_eval.expr/5
           (stdlib) erl_eval.erl:885: :erl_eval.expr_list/6
           (stdlib) erl_eval.erl:408: :erl_eval.expr/5


Error   : failed to execute hook (compile) on a6cc6f1fd118eb708da7cc00e4b1311961b2dbc2178fdc3ae225db435ee13efe: util:Exec:/opt/nanobox/hooks/compile: bad exit code(1):
Context : failed to compile the code -> failed to run the (compile)compile hook

Is there a way to make env vars available at compile time?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions