Created
April 7, 2021 21:29
-
-
Save michaelNgiri/3d2d79655bc2d338e75e446c3d96c48c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
def removeQuotesFromValue(value): | |
value = value.replace("'", '"') | |
# value = value.replace('"', "") | |
return value | |
def splitLineIntoParts(line): | |
line = line.lstrip() | |
line = line.rstrip() | |
line = removeQuotesFromValue(line) | |
line = line.split("=", 1) | |
return line | |
def setConfigVar(name, value): | |
os.system('heroku config:set ' + name + '=' + value) | |
with open('.env') as e: | |
for line in e: | |
l = splitLineIntoParts(line) | |
if (len(l) > 1): | |
name = l[0] | |
value = l[1] | |
print() | |
print ("*** Setting " + name + " = " + value + " ***") | |
setConfigVar(name, value) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment