Created
April 24, 2020 13:54
-
-
Save patmigliaccio/8bb1747c879e337f442b371cb3414f8f to your computer and use it in GitHub Desktop.
decodes an `ENV_FILE` env variable from a base 64 string in a .env file
This file contains 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 | |
import base64 | |
encoded_env_file = os.environ.get("ENV_FILE") | |
if encoded_env_file != None: | |
decoded_env_file = base64.b64decode(encoded_env_file).decode('utf-8') | |
with open("./" + str(os.environ.get("FILE_NAME", ".env")), "w") as text_file: | |
text_file.write(decoded_env_file) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment