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

$ is escaped in systemd file, preventing use of environment variables #124

Open
rb2nem opened this issue Mar 19, 2017 · 3 comments
Open

Comments

@rb2nem
Copy link

rb2nem commented Mar 19, 2017

Pleaserun generates a systemd unit including a directive EnvironmentFile, however,
when trying to specify an environment variable in the command to run, like

$PLEASERUN_COMMAND -p systemd /usr/bin/java -Xms\${MEMORY_INIT} -Xmx\${MEMORY_MAX} org.myorg.program

the generated unit file escapes the $:

ExecStart=/usr/bin/java "-Xms\${MEMORY_INIT}" "-Xmx\${MEMORY_MAX}"

The \ in the unit file is set by pleaserun, as putting the arguments in single quotes results in the $ being escaped too.

To make it work, the line has to be:

ExecStart=/usr/bin/java "-Xms${MEMORY_INIT}" "-Xmx${MEMORY_MAX}"

@nick-george
Copy link

+1

@jordansissel
Copy link
Owner

hmm.. Maybe we can add a flag that prevents the extra escaping that pleaserun is doing in the shell_args part of the systemd template?

I'm not exactly sure what the best approach would be for this. Open to ideas (though changing the current behavior is unlikely to work well given it would break existing things, so this will likely be a flag)

@nick-george
Copy link

Passing in extra flags on the command-line would work fine for me.

To give you a little background on why I'm wanting to do this. I'm building a customised Kibana, and wanting to pass in multiple configuration files. The default systemd service file only allows for one config file, which is why I'm wanting to play with the pleaserun arguments. It's such a shame that Kibana doesn't recognise environment variables to set configuration options!

I have a workaround however, I've modified the /usr/share/bin/kibana shell script to directly access environment variables that I've put into /etc/sysconfig/kibana. So no emergency on a fix (for me)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants