Commit 6bb203d6 by Jesse Shapiro Committed by Ned Batchelder

Adds OpenStack settings to CMS environment

and a comment and explaining why we import aws.* in the openstack settings.

(cherry picked from commit 9d5db5ae)
parent b22ab38f
......@@ -265,6 +265,9 @@ if FEATURES.get('AUTH_USE_CAS'):
CAS_ATTRIBUTE_CALLBACK['function']
)
# Specific setting for the File Upload Service to store media in a bucket.
FILE_UPLOAD_STORAGE_BUCKET_NAME = ENV_TOKENS.get('FILE_UPLOAD_STORAGE_BUCKET_NAME', FILE_UPLOAD_STORAGE_BUCKET_NAME)
FILE_UPLOAD_STORAGE_PREFIX = ENV_TOKENS.get('FILE_UPLOAD_STORAGE_PREFIX', FILE_UPLOAD_STORAGE_PREFIX)
################ SECURE AUTH ITEMS ###############################
# Secret things: passwords, access keys, etc.
......
......@@ -84,6 +84,10 @@ from lms.envs.common import (
# django-debug-toolbar
DEBUG_TOOLBAR_PATCH_SETTINGS,
BLOCK_STRUCTURES_SETTINGS,
# File upload defaults
FILE_UPLOAD_STORAGE_BUCKET_NAME,
FILE_UPLOAD_STORAGE_PREFIX,
)
from path import Path as path
from warnings import simplefilter
......
......@@ -2,4 +2,28 @@
Settings for OpenStack deployments.
"""
# We import the aws settings because that's currently where the base settings are stored for all deployments.
# TODO - fix this when aws.py is split/renamed.
from .aws import * # pylint: disable=wildcard-import, unused-wildcard-import
SWIFT_AUTH_URL = AUTH_TOKENS.get('SWIFT_AUTH_URL')
SWIFT_AUTH_VERSION = AUTH_TOKENS.get('SWIFT_AUTH_VERSION', 1)
SWIFT_USERNAME = AUTH_TOKENS.get('SWIFT_USERNAME')
SWIFT_KEY = AUTH_TOKENS.get('SWIFT_KEY')
SWIFT_TENANT_NAME = AUTH_TOKENS.get('SWIFT_TENANT_NAME')
SWIFT_TENANT_ID = AUTH_TOKENS.get('SWIFT_TENANT_ID')
SWIFT_CONTAINER_NAME = FILE_UPLOAD_STORAGE_BUCKET_NAME
SWIFT_NAME_PREFIX = FILE_UPLOAD_STORAGE_PREFIX
SWIFT_USE_TEMP_URLS = AUTH_TOKENS.get('SWIFT_USE_TEMP_URLS', False)
SWIFT_TEMP_URL_KEY = AUTH_TOKENS.get('SWIFT_TEMP_URL_KEY')
SWIFT_TEMP_URL_DURATION = AUTH_TOKENS.get('SWIFT_TEMP_URL_DURATION', 1800) # seconds
if AUTH_TOKENS.get('SWIFT_REGION_NAME'):
SWIFT_EXTRA_OPTIONS = {'region_name': AUTH_TOKENS['SWIFT_REGION_NAME']}
if AUTH_TOKENS.get('DEFAULT_FILE_STORAGE'):
DEFAULT_FILE_STORAGE = AUTH_TOKENS.get('DEFAULT_FILE_STORAGE')
elif SWIFT_AUTH_URL and SWIFT_USERNAME and SWIFT_KEY:
DEFAULT_FILE_STORAGE = 'swift.storage.SwiftStorage'
else:
DEFAULT_FILE_STORAGE = 'django.core.files.storage.FileSystemStorage'
......@@ -2,6 +2,8 @@
Settings for OpenStack deployments.
"""
# We import the aws settings because that's currently where the base settings are stored for all deployments.
# TODO - fix this when aws.py is split/renamed.
from .aws import * # pylint: disable=wildcard-import, unused-wildcard-import
SWIFT_AUTH_URL = AUTH_TOKENS.get('SWIFT_AUTH_URL')
......
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