Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow supervisord environment vars to have "+" #732

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions data/export/supervisord/app.conf.erb
Expand Up @@ -9,6 +9,7 @@ engine.each_process do |name, process|
value = value.gsub('\=', '=')
value = value.gsub('\&', '&')
value = value.gsub('\?', '?')
value = value.gsub('\+', '+')
"#{key}=\"#{value}\""
end
app_names << full_name
Expand Down
2 changes: 2 additions & 0 deletions spec/foreman/engine_spec.rb
Expand Up @@ -83,13 +83,15 @@ def shutdown
f.puts "FRED='barney'"
f.puts 'OTHER="escaped\"quote"'
f.puts 'URL="http://example.com/api?foo=bar&baz=1"'
f.puts 'KEY="LkZAMKGHwA9MsLj+rIVLmSMg+p206CeNaliqyFrjt9"'
end
subject.load_env "/tmp/env"
expect(subject.env["FOO"]).to eq("bar")
expect(subject.env["BAZ"]).to eq("qux")
expect(subject.env["FRED"]).to eq("barney")
expect(subject.env["OTHER"]).to eq('escaped"quote')
expect(subject.env["URL"]).to eq("http://example.com/api?foo=bar&baz=1")
expect(subject.env["KEY"]).to eq("LkZAMKGHwA9MsLj+rIVLmSMg+p206CeNaliqyFrjt9")
end

it "should handle multiline strings" do
Expand Down
2 changes: 1 addition & 1 deletion spec/foreman/export/supervisord_spec.rb
Expand Up @@ -14,7 +14,7 @@
before(:each) { allow(supervisord).to receive(:say) }

it "exports to the filesystem" do
write_env(".env", "FOO"=>"bar", "URL"=>"http://example.com/api?foo=bar&baz=1")
write_env(".env", "FOO"=>"bar", "URL"=>"http://example.com/api?foo=bar&baz=1", "KEY"=>"LkZAMKGHwA9MsLj+rIVLmSMg+p206CeNaliqyFrjt9")
supervisord.engine.load_env('.env')
supervisord.export
expect(File.read("/tmp/init/app.conf")).to eq(example_export_file("supervisord/app-alpha-1.conf"))
Expand Down
8 changes: 4 additions & 4 deletions spec/resources/export/supervisord/app-alpha-1.conf
Expand Up @@ -6,7 +6,7 @@ stdout_logfile=/var/log/app/alpha-1.log
stderr_logfile=/var/log/app/alpha-1.error.log
user=app
directory=/tmp/app
environment=FOO="bar",URL="http://example.com/api?foo=bar&baz=1",PORT="5000"
environment=FOO="bar",URL="http://example.com/api?foo=bar&baz=1",KEY="LkZAMKGHwA9MsLj+rIVLmSMg+p206CeNaliqyFrjt9",PORT="5000"

[program:app-bravo-1]
command=./bravo
Expand All @@ -16,7 +16,7 @@ stdout_logfile=/var/log/app/bravo-1.log
stderr_logfile=/var/log/app/bravo-1.error.log
user=app
directory=/tmp/app
environment=FOO="bar",URL="http://example.com/api?foo=bar&baz=1",PORT="5100"
environment=FOO="bar",URL="http://example.com/api?foo=bar&baz=1",KEY="LkZAMKGHwA9MsLj+rIVLmSMg+p206CeNaliqyFrjt9",PORT="5100"

[program:app-foo_bar-1]
command=./foo_bar
Expand All @@ -26,7 +26,7 @@ stdout_logfile=/var/log/app/foo_bar-1.log
stderr_logfile=/var/log/app/foo_bar-1.error.log
user=app
directory=/tmp/app
environment=FOO="bar",URL="http://example.com/api?foo=bar&baz=1",PORT="5200"
environment=FOO="bar",URL="http://example.com/api?foo=bar&baz=1",KEY="LkZAMKGHwA9MsLj+rIVLmSMg+p206CeNaliqyFrjt9",PORT="5200"

[program:app-foo-bar-1]
command=./foo-bar
Expand All @@ -36,7 +36,7 @@ stdout_logfile=/var/log/app/foo-bar-1.log
stderr_logfile=/var/log/app/foo-bar-1.error.log
user=app
directory=/tmp/app
environment=FOO="bar",URL="http://example.com/api?foo=bar&baz=1",PORT="5300"
environment=FOO="bar",URL="http://example.com/api?foo=bar&baz=1",KEY="LkZAMKGHwA9MsLj+rIVLmSMg+p206CeNaliqyFrjt9",PORT="5300"

[group:app]
programs=app-alpha-1,app-bravo-1,app-foo_bar-1,app-foo-bar-1