Skip to content

Commit

Permalink
Refactor environment variable handling in update-module script
Browse files Browse the repository at this point in the history
  • Loading branch information
stephdl authored and Amygos committed Oct 1, 2024
1 parent 970187e commit 5d77312
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions imageroot/update-module.d/10env
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,12 @@ if os.getenv("SERVICE_IP", None) is None:
# Clean up obsolete env variable
agent.unset_env('KML_INTERNAL_NETWORK')

# test if the passwords.env is present and if 'POSTGRES_PASSWORD' is present
if not os.path.exists("passwords.env") and os.getenv('POSTGRES_PASSWORD') is not None:
# create the passwords.env file
agent.write_envfile("passwords.env", {
"POSTGRES_PASSWORD": os.environ['POSTGRES_PASSWORD']
})

# unset the POSTGRES_PASSWORD
agent.unset_env('POSTGRES_PASSWORD')

0 comments on commit 5d77312

Please sign in to comment.