From b40ea6c2b3bb9d7c4555714bca0b45bf0a77f72d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Hedenstro=CC=88m?= <erik@erlang.ninja> Date: Wed, 24 Feb 2016 15:43:52 +0100 Subject: [PATCH] Fixed pattern so that only uppercase lettest, numbers, and underscore are allowed --- src/tsuru_application.erl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/tsuru_application.erl b/src/tsuru_application.erl index 06514d3..7ebcca2 100644 --- a/src/tsuru_application.erl +++ b/src/tsuru_application.erl @@ -8,7 +8,10 @@ set_env(Application) -> [{application:set_env(Application, Name, Value, [{timeout, infinity}, {persistent, true}]), {Name, Value}} || {Name, Value} <- get_os_env(Application)]. get_os_env(Application) -> - Pattern = string:to_upper(atom_to_list(Application)) ++ "_(.+)=(.+)", + S1 = string:to_upper(atom_to_list(Application)), + S2 = re:replace(S1, "-", "_", [global, {return, list}]), + S3 = re:replace(S2, "[^A-Z1-9_]", "", [global, {return, list}]), + Pattern = S3 ++ "_(.+)=(.+)", get_os_env(Pattern, os:getenv(), erl_eval:new_bindings()). %%%=================================================================== -- GitLab