From 939a2b042c8a0b1a64823cbf642b9415a1a2c306 Mon Sep 17 00:00:00 2001 From: Ben Langfeld Date: Mon, 18 Jan 2016 19:13:59 -0200 Subject: [PATCH] Parameterise runtime app path --- README.md | 3 +++ elixir_buildpack.config | 1 + lib/erlang_funcs.sh | 8 ++++---- lib/path_funcs.sh | 6 +++++- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 2e55f3b8..32c1946c 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,9 @@ config_vars_to_export=(DATABASE_URL) # A command to run right after compiling the app post_compile="pwd" + +# Set the path the app is run from +runtime_path=/app ``` diff --git a/elixir_buildpack.config b/elixir_buildpack.config index 79d4ac5a..7f97cc09 100644 --- a/elixir_buildpack.config +++ b/elixir_buildpack.config @@ -2,3 +2,4 @@ erlang_version=18.1.3 elixir_version=1.2.0 always_rebuild=false config_vars_to_export=(DATABASE_URL) +runtime_path=/app diff --git a/lib/erlang_funcs.sh b/lib/erlang_funcs.sh index f2140c61..b42b939d 100644 --- a/lib/erlang_funcs.sh +++ b/lib/erlang_funcs.sh @@ -31,10 +31,10 @@ function install_erlang() { mkdir -p $(erlang_build_path) tar zxf ${cache_path}/$(erlang_tarball) -C $(erlang_build_path) --strip-components=1 - rm -rf /app/.platform_tools/erlang - mkdir -p /app/.platform_tools - ln -s $(erlang_build_path) /app/.platform_tools/erlang - $(erlang_build_path)/Install -minimal /app/.platform_tools/erlang + rm -rf $(runtime_erlang_path) + mkdir -p $(runtime_platform_tools_path) + ln -s $(erlang_build_path) $(runtime_erlang_path) + $(erlang_build_path)/Install -minimal $(runtime_erlang_path) cp -R $(erlang_build_path) $(erlang_path) PATH=$(erlang_path)/bin:$PATH diff --git a/lib/path_funcs.sh b/lib/path_funcs.sh index e83cb33d..7f462bdc 100644 --- a/lib/path_funcs.sh +++ b/lib/path_funcs.sh @@ -6,8 +6,12 @@ function erlang_path() { echo "$(platform_tools_path)/erlang" } +function runtime_platform_tools_path() { + echo "${runtime_path}/.platform_tools" +} + function runtime_erlang_path() { - echo "/app/.platform_tools/erlang" + echo "$(runtime_platform_tools_path)/erlang" } function elixir_path() {