From deb9d3404c50dad159b39ffdff2a85f75d4c655f Mon Sep 17 00:00:00 2001 From: arnoldokoth Date: Fri, 26 May 2017 17:45:57 +0300 Subject: [PATCH 1/2] Add makefile and gitmodules file --- .gitmodules | 3 +++ Makefile | 13 +++++++++++++ dev | 1 + 3 files changed, 17 insertions(+) create mode 100644 Makefile create mode 160000 dev diff --git a/.gitmodules b/.gitmodules index e69de29..cf345f4 100644 --- a/.gitmodules +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "dev"] + path = dev + url = https://github.com/Blocp/dev diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..475fdb2 --- /dev/null +++ b/Makefile @@ -0,0 +1,13 @@ +# Create Test & Local Configuration Files +config: + cp ./app/config/test.default.py ./app/config/test.py && cp ./app/config/local.default.py ./app/config/local.py + +# Create an alias for localhost +# This will be useful to point docker-compose to postgres & redis running locally +alias: + sudo ifconfig lo0 alias 200.10.10.1 255.255.255.0 + + +# Generate Docker Compose File +dc: + svc_appservice='' svc_documentservice='' svc_userservice='' envtpl < dev/compose.yaml.jinja2 > docker-compose.yml diff --git a/dev b/dev new file mode 160000 index 0000000..585967c --- /dev/null +++ b/dev @@ -0,0 +1 @@ +Subproject commit 585967c4ef82f7ebae32424bff13824cb0cf3c3c -- GitLab From 57d280b33db06c80b2237e8474bd7096aa363c8f Mon Sep 17 00:00:00 2001 From: arnoldokoth Date: Wed, 31 May 2017 16:23:01 +0300 Subject: [PATCH 2/2] Fetch configuration variables from environment --- app/config/local.default.py | 23 +++++++++++++---------- app/config/test.default.py | 15 +++++++++------ 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/app/config/local.default.py b/app/config/local.default.py index ca502b4..01aed8c 100644 --- a/app/config/local.default.py +++ b/app/config/local.default.py @@ -1,21 +1,24 @@ +import os + + SQLALCHEMY_TRACK_MODIFICATIONS = False -SQLALCHEMY_DATABASE_URI = 'postgresql:///buildingservice' +SQLALCHEMY_DATABASE_URI = os.environ['SQLALCHEMY_DATABASE_URI'] -REDIS_URI = 'redis://127.0.0.1:6379/' +REDIS_URI = os.environ['REDIS_URI'] DEBUG = True SERVICE_CONFIG = { - 'app_key': '$APP_KEY', - 'app_secret': '$APP_SECRET', + 'app_key': os.environ['APP_KEY'], + 'app_secret': os.environ['APP_SECRET'], 'headers': { 'app_key': 'x-blocpower-app-key', 'app_token': 'x-blocpower-app-token', 'app_secret': 'x-blocpower-app-secret'}, 'urls': { - 'app': 'http://127.0.0.1:5400', - 'document': 'http://127.0.0.1:5403', - 'user': 'http://127.0.0.1:5401'} + 'app': os.environ['APP_SERVICE'], + 'document': os.environ['DOC_SERVICE'], + 'user': os.environ['USER_SERVICE']} } # AppService @@ -30,6 +33,6 @@ HEADER_AUTH_KEY = 'x-blocpower-auth-key' HEADER_AUTH_TOKEN = 'x-blocpower-auth-token' # Mechanical Turk credentials -AWS_ACCESS_KEY = '$AWS_KEY' -AWS_SECRET_ACCESS_KEY = '$AWS_SECRET_KEY' -MECH_TURK_HOST = '$MECH_TURK_HOST' +AWS_ACCESS_KEY = os.environ['AWS_ACCESS_KEY'] +AWS_SECRET_ACCESS_KEY = os.environ['AWS_SECRET_KEY'] +MECH_TURK_HOST = os.environ['MECH_TURK_HOST'] diff --git a/app/config/test.default.py b/app/config/test.default.py index d6cdbbb..7857cb0 100644 --- a/app/config/test.default.py +++ b/app/config/test.default.py @@ -1,21 +1,24 @@ +import os + + SQLALCHEMY_TRACK_MODIFICATIONS = False -SQLALCHEMY_DATABASE_URI = 'postgresql:///buildingservice-testing' +SQLALCHEMY_DATABASE_URI = os.environ['SQLALCHEMY_DATABASE_URI'] -REDIS_URI = 'redis://127.0.0.1:6379/' +REDIS_URI = os.environ['REDIS_URI'] DEBUG = True TESTING = True SERVICE_CONFIG = { - 'app_key': '$APP_KEY', - 'app_secret': '$APP_SECRET', + 'app_key': os.environ['APP_KEY'], + 'app_secret': os.environ['APP_SECRET'], 'headers': { 'app_key': 'x-blocpower-app-key', 'app_token': 'x-blocpower-app-token', 'app_secret': 'x-blocpower-app-secret'}, 'urls': { - 'app': 'http://127.0.0.1:5400', - 'user': 'http://127.0.0.1:5401'} + 'app': os.environ['APP_SERVICE'], + 'user': os.environ['USER_SERVICE']} } # App -- GitLab