-
Notifications
You must be signed in to change notification settings - Fork 327
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
Access to environment variables in Unit config #968
Comments
Oooooh, this is a good one. I use |
Hi,
But the option To make it short, the feature is about whether Unit provides variable engine in the application starting phase. |
Hi, our thoughts on it:
Thanks. |
If we consider that envsubst(1) and similar tools provides a reasonable workaround today, how useful would it be to "pass through" specific environment variables to the application's environment? {
"applications": {
"foo": {
"type": "external",
"working_directory": "/path/to/thing",
"executable": "app",
"environment_passthrough": ["SOME_ENV_VAR", "OTHER_ENV_VAR"],
"environment": {
"HOME": "/path/to/thing"
}
}
}
} Would this be a worthwhile feature in its own right? Or is full access to env vars, across the entire configuration scope the main thing? If so, we might also consider environment variable substitution a function that the |
Our use-case would be to configure number of |
Yup, same here. Here's what one of our configs looks like and how we use ENV vars in our config: "applications": {
"sinatra": {
"type": "ruby",
"processes": {{ NUM_WORKERS }},
"threads": {{ WORKER_THREADS_MAX }},
"script": "{{ HOME }}/workspace/app/config.ru",
"hooks": "{{ HOME }}/workspace/app/config/unit/hooks.rb",
"working_directory": "{{ HOME}}/workspace/app/",
"limits": {
"timeout": 30
}
}
} |
@lcrilly Does this issue needs work. Would be happy to work on it |
Yes, still open. Would welcome a contribution but makes sense to discuss the approach and design here, first. For example, are we reading the env vars of the user applying the configuration or the user that owns the |
When writing a Unit config, certain parts may need to be dynamically inserted, and so it would be great to be able to reference env vars that get evaluated at runtime. For example, I'd like to be able to do this:
Which currently does not work.
The text was updated successfully, but these errors were encountered: