summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2019-01-04 13:00:38 -0800
committerBryan Newbold <bnewbold@robocracy.org>2019-01-04 13:00:38 -0800
commitbb6840ab32d39240442f32c89ac3c4d0722d8372 (patch)
treea6b6b347a71255f2e5ec320dce7faa37555b1f6d
parent00c0859a7df360380a479eb9dbc79057c0245969 (diff)
downloadfatcat-bb6840ab32d39240442f32c89ac3c4d0722d8372.tar.gz
fatcat-bb6840ab32d39240442f32c89ac3c4d0722d8372.zip
use .env for all config (and document it)
-rw-r--r--python/.gitignore1
-rw-r--r--python/README.md4
-rw-r--r--python/env.example8
-rw-r--r--python/fatcat_web/__init__.py3
-rw-r--r--python/fatcat_web/web_config.py (renamed from python/web_config.py)0
5 files changed, 15 insertions, 1 deletions
diff --git a/python/.gitignore b/python/.gitignore
index e2dae299..a0bc258b 100644
--- a/python/.gitignore
+++ b/python/.gitignore
@@ -1,3 +1,4 @@
+.env
codegen-out/
build/
dist/
diff --git a/python/README.md b/python/README.md
index d8812934..922499f3 100644
--- a/python/README.md
+++ b/python/README.md
@@ -34,6 +34,10 @@ server on the same machine by default), use:
# will listen on http://localhost:9810 by default
pipenv run fatcat_webface.py
+Almost all configuration is done via environment variables; see `env.example`
+for a list of settings. If you copy this file to `.env` it will be sourced by
+`pipenv` automatically; you can also load it in your shell like `source .env`.
+
## Running Tests
Many (though not all) python tests depend on access to a local running API
diff --git a/python/env.example b/python/env.example
new file mode 100644
index 00000000..c139df07
--- /dev/null
+++ b/python/env.example
@@ -0,0 +1,8 @@
+FLASK_SECRET_KEY=""
+FATCAT_API_AUTH_TOKEN=""
+FATCAT_API_HOST="http://localhost:9411/v0"
+ELASTICSEARCH_BACKEND="http://localhost:9200"
+ELASTICSEARCH_INDEX="fatcat"
+GITLAB_CLIENT_ID=""
+GITLAB_CLIENT_SECRET=""
+SENTRY_DSN=""
diff --git a/python/fatcat_web/__init__.py b/python/fatcat_web/__init__.py
index 34618076..53947143 100644
--- a/python/fatcat_web/__init__.py
+++ b/python/fatcat_web/__init__.py
@@ -6,9 +6,10 @@ from flask_login import LoginManager
from authlib.flask.client import OAuth
from loginpass import create_flask_blueprint, Gitlab
from raven.contrib.flask import Sentry
-from web_config import Config
import fatcat_client
+from fatcat_web.web_config import Config
+
toolbar = DebugToolbarExtension()
app = Flask(__name__)
app.config.from_object(Config)
diff --git a/python/web_config.py b/python/fatcat_web/web_config.py
index 5713738c..5713738c 100644
--- a/python/web_config.py
+++ b/python/fatcat_web/web_config.py