Skip to content

Instantly share code, notes, and snippets.

@tlugger
Last active May 8, 2018 19:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tlugger/2da9c8e615265243c07c76549f402ca6 to your computer and use it in GitHub Desktop.
Save tlugger/2da9c8e615265243c07c76549f402ca6 to your computer and use it in GitHub Desktop.
# A script to move instance environment variables from nio.env to the new nio.conf [user_defined]section.
# Useful for migrating a project from nio-core < 20170126
#
# Usage:
# Run this script from inside the project root
#
# Example:
# python move-conf.py
#
# All variables set in nio.env will now show up at the bottom of nio.conf in a [user_defined] section
with open('nio.conf', 'a') as nconf, open('nio.env', 'r') as nenv:
for line in nenv:
if '[vars]' in line:
nconf.write('\n[user_defined]\n')
else:
conf_line = line.replace(': ', '=')
nconf.write(conf_line)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment