Skip to content

Commit

Permalink
Allows maximum resource upload size to be specified as an env variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Nevelina Aleksandrova committed Mar 8, 2018
1 parent 6f31119 commit 1b7bd69
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion ckan/config/environment.py
Expand Up @@ -143,7 +143,8 @@ def find_controller(self, controller):
'smtp.starttls': 'CKAN_SMTP_STARTTLS',
'smtp.user': 'CKAN_SMTP_USER',
'smtp.password': 'CKAN_SMTP_PASSWORD',
'smtp.mail_from': 'CKAN_SMTP_MAIL_FROM'
'smtp.mail_from': 'CKAN_SMTP_MAIL_FROM',
'ckan.max_resource_size': 'CKAN_MAX_UPLOAD_SIZE_MB'
}
# End CONFIG_FROM_ENV_VARS

Expand Down
4 changes: 3 additions & 1 deletion ckan/tests/config/test_environment.py
Expand Up @@ -31,7 +31,8 @@ class TestUpdateConfig(h.FunctionalTestBase):
('CKAN_SMTP_STARTTLS', 'True'),
('CKAN_SMTP_USER', 'my_user'),
('CKAN_SMTP_PASSWORD', 'password'),
('CKAN_SMTP_MAIL_FROM', 'server@example.com')
('CKAN_SMTP_MAIL_FROM', 'server@example.com'),
('CKAN_MAX_UPLOAD_SIZE_MB', '50')
]

def _setup_env_vars(self):
Expand Down Expand Up @@ -71,6 +72,7 @@ def test_update_config_env_vars(self):
nosetools.assert_equal(config['smtp.user'], 'my_user')
nosetools.assert_equal(config['smtp.password'], 'password')
nosetools.assert_equal(config['smtp.mail_from'], 'server@example.com')
nosetools.assert_equal(config['ckan.max_resource_size'], '50')

def test_update_config_db_url_precedence(self):
'''CKAN_SQLALCHEMY_URL in the env takes precedence over CKAN_DB'''
Expand Down
1 change: 1 addition & 0 deletions contrib/docker/ckan-entrypoint.sh
Expand Up @@ -33,6 +33,7 @@ set_environment () {
export CKAN_SMTP_USER=${CKAN_SMTP_USER}
export CKAN_SMTP_PASSWORD=${CKAN_SMTP_PASSWORD}
export CKAN_SMTP_MAIL_FROM=${CKAN_SMTP_MAIL_FROM}
export CKAN_MAX_UPLOAD_SIZE_MB=${CKAN_MAX_UPLOAD_SIZE_MB}
}

write_config () {
Expand Down

0 comments on commit 1b7bd69

Please sign in to comment.