Commit 162bfb5e by Oleg Marshev Committed by Tim Babych

Merge pull request #6 from oleg/yml-settings

parent ae7fcd50
...@@ -16,6 +16,15 @@ SECRET_KEY = '*^owi*4%!%9=#h@app!l^$jz8(c*q297^)4&4yn^#_m#fq=z#l' ...@@ -16,6 +16,15 @@ SECRET_KEY = '*^owi*4%!%9=#h@app!l^$jz8(c*q297^)4&4yn^#_m#fq=z#l'
CLIENT_ID = 'edx-notes-id' CLIENT_ID = 'edx-notes-id'
CLIENT_SECRET = 'edx-notes-secret' CLIENT_SECRET = 'edx-notes-secret'
ELASTICSEARCH_URL = 'http://127.0.0.1:9200'
ELASTICSEARCH_INDEX = 'edx-notes'
# Number of rows to return by default in result.
RESULTS_DEFAULT_SIZE = 25
# Max number of rows to return in result.
RESULTS_MAX_SIZE = 250
ROOT_URLCONF = 'notesserver.urls' ROOT_URLCONF = 'notesserver.urls'
MIDDLEWARE_CLASSES = ( MIDDLEWARE_CLASSES = (
......
...@@ -4,20 +4,12 @@ from .common import * ...@@ -4,20 +4,12 @@ from .common import *
DEBUG = True DEBUG = True
ELASTICSEARCH_URL = 'http://127.0.0.1:9200'
ELASTICSEARCH_INDEX = 'edx-notes-dev' ELASTICSEARCH_INDEX = 'edx-notes-dev'
# Overwrite default annotator-store elasticsearch settings. ###############################################################################
es.host = ELASTICSEARCH_URL
es.index = ELASTICSEARCH_INDEX
# Number of rows to return by default in result.
RESULTS_DEFAULT_SIZE = 25
# Max number of rows to return in result.
RESULTS_MAX_SIZE = 250
# Override default annotator-store elasticsearch settings. # Override default annotator-store elasticsearch settings.
###############################################################################
es.host = ELASTICSEARCH_URL es.host = ELASTICSEARCH_URL
es.index = ELASTICSEARCH_INDEX es.index = ELASTICSEARCH_INDEX
annotator.elasticsearch.RESULTS_MAX_SIZE = RESULTS_MAX_SIZE annotator.elasticsearch.RESULTS_MAX_SIZE = RESULTS_MAX_SIZE
###############################################################################
from .common import *
DEBUG = False
ALLOWED_HOSTS = ['*']
...@@ -12,16 +12,12 @@ TEST_RUNNER = 'django_nose.NoseTestSuiteRunner' ...@@ -12,16 +12,12 @@ TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
INSTALLED_APPS += ('django_nose',) INSTALLED_APPS += ('django_nose',)
ELASTICSEARCH_URL = 'http://127.0.0.1:9200'
ELASTICSEARCH_INDEX = 'edx-notes-test' ELASTICSEARCH_INDEX = 'edx-notes-test'
# Number of rows to return by default in result. ###############################################################################
RESULTS_DEFAULT_SIZE = 25
# Max number of rows to return in result.
RESULTS_MAX_SIZE = 250
# Override default annotator-store elasticsearch settings. # Override default annotator-store elasticsearch settings.
###############################################################################
es.host = ELASTICSEARCH_URL es.host = ELASTICSEARCH_URL
es.index = ELASTICSEARCH_INDEX es.index = ELASTICSEARCH_INDEX
annotator.elasticsearch.RESULTS_MAX_SIZE = RESULTS_MAX_SIZE annotator.elasticsearch.RESULTS_MAX_SIZE = RESULTS_MAX_SIZE
###############################################################################
import yaml
import annotator
from annotator import es
from .common import * # pylint: disable=unused-wildcard-import, wildcard-import
###############################################################################
# Explicitly declare here in case someone changes common.py.
###############################################################################
DEBUG = False
TEMPLATE_DEBUG = False
DISABLE_TOKEN_CHECK = False
###############################################################################
CONFIG_ROOT = os.environ.get('EDXNOTES_CONFIG_ROOT')
with open(CONFIG_ROOT / "edx-notes-api.yml") as yaml_file:
config_from_yaml = yaml.load(yaml_file)
vars().update(config_from_yaml)
###############################################################################
# Override default annotator-store elasticsearch settings.
###############################################################################
es.host = ELASTICSEARCH_URL
es.index = ELASTICSEARCH_INDEX
annotator.elasticsearch.RESULTS_MAX_SIZE = RESULTS_MAX_SIZE
###############################################################################
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment