I have written an Escript app with Elixir.
I have a Config
module that checks for a config file that contains some json. The location of the file is supposed to be in ~/.myapprc
This works (for me) when I build the app with mix escript.build
locally. However when I build it in our CI/CD environment it looks like ~ is being expanded to /root/.myapprc
config.exs:
config :app, config_file: Path.join([System.user_home(), '.myapprc'])
config module
@config_file Application.get_env(:app, :config_file)
...
def check do
say("Looking for #{@config_file}")
unless File.exists?(@config_file) do
say("*** profile config file not found")
create_file(@config_file, Poison.encode!(%{}), [:binary])
end
end
Output from local build
./_build/app
Looking for /Users/tomha/.myapprc
Output from build from CI/CD
$ ./app
Looking for /root/.myapprc
*** profile config file not found
* error enoent
Is this because the config.exs are compiling the build systems user into the application?