Now includes message for missing .env file. Fixed #819

This commit is contained in:
Daniel Roy Greenfeld 2016-09-26 09:28:35 -07:00 committed by Fabio C. Barrioneuvo da Luz
parent c4ad073f0d
commit d31e86fc8a

View File

@ -1,5 +1,6 @@
"""Converts a .env file to Elastic Beanstalk environment variables"""
import os
from sys import exit
from subprocess import check_call
@ -10,10 +11,15 @@ except ImportError:
exit()
def main():
if not os.path.exists('.env'):
print('ERROR!! .env file is missing!')
print("Please copy 'env.example' to '.env' and add appropriate values")
exit()
command = ['eb', 'setenv']
failures = []
for key, value in dotenv.Dotenv('.env').items():
if key.startswith('POSTGRES'):
print('Skipping POSTGRES values - Amazon RDS provides these')
continue
if value:
command.append("{}={}".format(key, value))