Skip to content

Commit

Permalink
Merge branch 'master' into make-vocabulary-dictize-faster
Browse files Browse the repository at this point in the history
Conflicts:
	CHANGELOG.rst
  • Loading branch information
David Read committed Jun 13, 2015
2 parents 90d0ddd + e2e1970 commit 1b3b713
Show file tree
Hide file tree
Showing 50 changed files with 1,062 additions and 2,068 deletions.
8 changes: 6 additions & 2 deletions CHANGELOG.rst
Expand Up @@ -32,8 +32,12 @@ Changes and deprecations

* The ``vocabulary_show`` and ``tag_show`` API calls no longer returns the
``packages`` key - i.e. datasets that use the vocabulary or tag.
``tag_show`` now has an ``include_datasets`` option and has been extended
to work with vocabulary tags. (#1886)
However ``tag_show`` now has an ``include_datasets`` option. (#1886)

* `organization_list_for_user` now returns organizations in hierarchy if they
exist for roles set in `ckan.auth.roles_that_cascade_to_sub_groups`.

* Update license keys to match opendefinition.org #2110


v2.3 2015-03-04
Expand Down
1 change: 1 addition & 0 deletions ckan/config/deployment.ini_tmpl
Expand Up @@ -115,6 +115,7 @@ ckan.preview.loadable = html htm rdf+xml owl+xml xml n3 n-triples turtle plain a
# package_hide_extras = for_search_index_only
#package_edit_return_url = http://another.frontend/dataset/<NAME>
#package_new_return_url = http://another.frontend/dataset/<NAME>
#ckan.recaptcha.version = 1
#ckan.recaptcha.publickey =
#ckan.recaptcha.privatekey =
#licenses_group_url = http://licenses.opendefinition.org/licenses/groups/ckan.json
Expand Down
38 changes: 30 additions & 8 deletions ckan/config/environment.py
Expand Up @@ -232,6 +232,21 @@ def genshi_lookup_attr(cls, obj, key):
p.load_all(config)


# A mapping of config settings that can be overridden by env vars.
CONFIG_FROM_ENV_VARS = {
'sqlalchemy.url': 'CKAN_SQLALCHEMY_URL',
'ckan.datastore.write_url': 'CKAN_DATASTORE_WRITE_URL',
'ckan.datastore.read_url': 'CKAN_DATASTORE_READ_URL',
'solr_url': 'CKAN_SOLR_URL',
'ckan.site_id': 'CKAN_SITE_ID',
'smtp.server': 'CKAN_SMTP_SERVER',
'smtp.starttls': 'CKAN_SMTP_STARTTLS',
'smtp.user': 'CKAN_SMTP_USER',
'smtp.password': 'CKAN_SMTP_PASSWORD',
'smtp.mail_from': 'CKAN_SMTP_MAIL_FROM'
}


def update_config():
''' This code needs to be run when the config is changed to take those
changes into account. '''
Expand All @@ -241,11 +256,22 @@ def update_config():
# config = plugin.update_config(config)
plugin.update_config(config)

root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Set whitelisted env vars on config object
# This is set up before globals are initialized
site_id = os.environ.get('CKAN_SITE_ID')
if site_id:
config['ckan.site_id'] = site_id

ckan_db = os.environ.get('CKAN_DB', None)
if ckan_db:
msg = 'Setting CKAN_DB as an env var is deprecated and will be' \
' removed in a future release. Use CKAN_SQLALCHEMY_URL instead.'
log.warn(msg)
config['sqlalchemy.url'] = ckan_db

for option in CONFIG_FROM_ENV_VARS:
from_env = os.environ.get(CONFIG_FROM_ENV_VARS[option], None)
if from_env:
config[option] = from_env

root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

site_url = config.get('ckan.site_url', '')
ckan_host = config['ckan.host'] = urlparse(site_url).netloc
Expand Down Expand Up @@ -341,10 +367,6 @@ def template_loaded(template):
# CONFIGURATION OPTIONS HERE (note: all config options will override
# any Pylons config options)

ckan_db = os.environ.get('CKAN_DB')
if ckan_db:
config['sqlalchemy.url'] = ckan_db

# for postgresql we want to enforce utf-8
sqlalchemy_url = config.get('sqlalchemy.url', '')
if sqlalchemy_url.startswith('postgresql://'):
Expand Down

0 comments on commit 1b3b713

Please sign in to comment.