question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

configuration: support environment variables

See original GitHub issue

A common use case when running an application inside Docker is passing configuration parameters via Environment variables.

We could introduce support for reading the values of configuration parameters from environment variables in settings.json, taking inspiration from ElasticSearch’s environment variable substitution:

Environment variables referenced with the ${…} notation within the configuration file will be replaced with the value of the environment variable, for instance:

node.name:    ${HOSTNAME}
network.host: ${ES_NETWORK_HOST}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
muxatorcommented, Mar 10, 2019

Implemented. The PR is #3572.

Please note that there is going to be a little Etherpad-specific remark, due to being tied to use a JSON file for configuration. Even when replacing a variable whose value would be a boolean or a number, quotes must be used. Etherpad, then, takes care of converting back the configuration parameter from string to the right type.

The documentation is in https://github.com/ether/etherpad-lite/blob/3b6b12e8482bb641252c2aa8fff225d61cd5225b/settings.json.template.

   "port":   9001,          <-- Literal values. When not using substitution,
   "minify": false              only strings must be quoted: booleans and
   "skin":   "colibris"         numbers must not.

   "port":   ${PORT}        <-- ERROR: this is not valid json
   "minify": ${MINIFY}
   "skin":   ${SKIN_NAME}

   "port":   "${PORT}"      <-- CORRECT: if you want to use a variable
   "minify": "${MINIFY}"        substitution, put quotes around its name,
   "skin":   "${SKIN_NAME}"     even if the required value is a number or a
                                boolean.
                                Etherpad will take care of rewriting it to
                                the proper type if necessary.
1reaction
muxatorcommented, Jun 23, 2019

Hi, @gobengo, I am glad this enabled a new deployment possibility.

A rough breakdown of the remaining issues for the 1.8 milestone is as follows:

  1. there are two remaining security issues that really have to be fixed before releasing 1.8: 1.a #3598, a problem with tar library in a transitive dependency of npm 1.b the clean-css library requires a major version bump, and this requires some work (see ~https://github.com/ether/etherpad-lite/pull/3597#issuecomment-483851384~ #3616)
  2. the async migration introduced many important changes, but there are still two issues that need to be addressed (see #3568 and #3566)
  3. there is some feature work that could probably be postponed to a later version

If you have the possibility of working on 1.a, 1.b or 2, this could help a lot. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Use environment variables in the configuration - Elastic
You can use environment variable references in the config file to set values that need to be configurable during deployment. To do this,...
Read more >
Create and Modify Environment Variables on Windows
On the Advanced tab, click Environment Variables. Click New to create a new environment variable. Click Edit to modify an existing environment variable....
Read more >
Environment variables to configure the AWS CLI
The AWS CLI supports the following environment variables. Specifies an AWS access key associated with an IAM user or role. If defined, this...
Read more >
Configuring Environment Variables and Secrets - Render
Click on Environment in the left pane, and then click on Add Environment Variable. Service environment. Enter the Key and Value for your...
Read more >
Environment Variables: What They Are and How To Use Them
Environment variables are used to store app secrets and configuration data, which are retrieved by your running app when needed.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found