-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
77 additions
and
27 deletions.
There are no files selected for viewing
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"pymongo": { | ||
"client": { | ||
"host": "localhost", | ||
"port": 27017 | ||
}, | ||
"database": "restriccion" | ||
}, | ||
"moment": { | ||
"timezone": "UTC-3" | ||
}, | ||
"notifications": { | ||
"gcm": { | ||
"api_key": "dummy_gcm_key" | ||
}, | ||
"email": { | ||
"enabled": false, | ||
"template": "template_email_test.html", | ||
"server": { | ||
"host": ["localhost"], | ||
"login": ["user", "pass"] | ||
}, | ||
"from": "dummy@email.com", | ||
"subject": "Dummy email" | ||
} | ||
} | ||
} |
File renamed without changes.
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
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,3 @@ | ||
import json | ||
import os | ||
from restriccion.libs.env import load_env_params | ||
|
||
|
||
script_path = os.path.dirname(os.path.realpath(__file__)) | ||
config_file_path = os.environ.get( | ||
'RESTRICCION_CONFIG', | ||
os.path.join(script_path, '..', 'configs/localhost.json') | ||
) | ||
|
||
|
||
with open(config_file_path, 'r') as config_file: | ||
CONFIG = json.load(config_file) | ||
CONFIG = load_env_params() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import json | ||
import os | ||
import sys | ||
|
||
|
||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) | ||
|
||
|
||
def _get_config_path(filename): | ||
config_paths = [ | ||
os.path.join(BASE_DIR, 'configs'), | ||
os.path.join(os.path.expanduser('~'), 'configs'), | ||
] | ||
for config_path in config_paths: | ||
p = os.path.join(config_path, filename) | ||
if os.path.exists(p): | ||
return p | ||
return None | ||
|
||
|
||
def load_env_params(): | ||
env = os.environ.get('ENV') | ||
|
||
config_path = _get_config_path('env_{0:s}.json'.format(env)) | ||
|
||
if config_path is None: | ||
print('ERROR: {0:s} environment config file not found'.format(env), file=sys.stderr) | ||
return | ||
|
||
with open(config_path) as f: | ||
data = json.load(f) | ||
|
||
return data |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
#!/usr/bin/env python3 | ||
import os | ||
|
||
os.environ.setdefault('ENV', 'local') | ||
|
||
from restriccion.wsgi import app | ||
|
||
|
||
|