From 259f1fe6d3cf20794531751341286c11d9ecf2f8 Mon Sep 17 00:00:00 2001 From: Richard Louapre Date: Sun, 26 Jun 2016 10:00:31 -0400 Subject: [PATCH] Fix #591 --- deploy/lib/server_config.rb | 4 ++-- .../test/data/ml7-properties/build.properties | 2 ++ deploy/test/test_server_config.rb | 18 ++++++++++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/deploy/lib/server_config.rb b/deploy/lib/server_config.rb index bf6fb2d6..d91829c0 100644 --- a/deploy/lib/server_config.rb +++ b/deploy/lib/server_config.rb @@ -2556,9 +2556,9 @@ def ServerConfig.properties(prop_file_location = @@path) properties.merge!(ServerConfig.load_properties(env_properties_file, "ml.")) if File.exists? env_properties_file - properties = ServerConfig.substitute_properties(properties, properties, "ml.") - properties = load_prop_from_args(properties) + + properties = ServerConfig.substitute_properties(properties, properties, "ml.") end end diff --git a/deploy/test/data/ml7-properties/build.properties b/deploy/test/data/ml7-properties/build.properties index c356b335..51859382 100644 --- a/deploy/test/data/ml7-properties/build.properties +++ b/deploy/test/data/ml7-properties/build.properties @@ -147,3 +147,5 @@ local-server=localhost #cert-server= #prod-server= yoda-age= +dummy-port=9999 +dummy2-port=${dummy-port} diff --git a/deploy/test/test_server_config.rb b/deploy/test/test_server_config.rb index 9992c7b2..8db4439f 100644 --- a/deploy/test/test_server_config.rb +++ b/deploy/test/test_server_config.rb @@ -188,6 +188,24 @@ end + # issue #591 + describe "override properties from command" do + + before do + ARGV << "--ml.dummy-port=8888" + @properties = ServerConfig.properties(File.expand_path("../data/ml7-properties/", __FILE__)) + end + + it "should load valid properites from a command" do + @properties['ml.dummy-port'].must_equal '8888' + @properties['ml.dummy2-port'].must_equal '8888' + end + + after do + ARGV.shift + ARGV.shift + end + end def with_stdin stdin = $stdin # remember $stdin