aboutsummaryrefslogtreecommitdiff
path: root/config.env.py
diff options
context:
space:
mode:
authorGalen Guyer <galen@galenguyer.com>2020-10-31 11:58:32 -0400
committerGalen Guyer <galen@galenguyer.com>2020-10-31 11:59:58 -0400
commit1009968ea0ca43ef1b1bc421f7694f1f70707948 (patch)
treef40c80a45095782290fb1af52bd7e683d6a74710 /config.env.py
Initial commit
Diffstat (limited to 'config.env.py')
-rw-r--r--config.env.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/config.env.py b/config.env.py
new file mode 100644
index 0000000..e996ffa
--- /dev/null
+++ b/config.env.py
@@ -0,0 +1,17 @@
+import secrets
+import os
+
+# Values in this file are loaded into the flask app instance, `demo.APP` in this
+# demo. This file sources values from the environment if they exist, otherwise a
+# set of defaults are used. This is useful for keeping secrets secret, as well
+# as facilitating configuration in a container. Defaults may be overriden either
+# by defining the environment variables, or by creating a `config.py` file that
+# contains locally set secrets or config values.
+
+
+# Defaults for flask configuration
+IP = os.environ.get('IP', '127.0.0.1')
+PORT = os.environ.get('PORT', 5000)
+SERVER_NAME = os.environ.get('SERVER_NAME', 'localhost:5000')
+SECRET_KEY = os.environ.get('SESSION_KEY', default=''.join(secrets.token_hex(16)))
+