Skip to content

Commit

Permalink
added ALLOWED_DOCUMENT_TYPES and MAX_DOCUMENT_SIZE as environmental s…
Browse files Browse the repository at this point in the history
…etting to django.env and celery.env. Modified settings.py to read these (doc size was allready implemented)

changed some environmental vars back to default
  • Loading branch information
admin authored and gannebamm committed Jan 22, 2019
1 parent aad2d60 commit 72f80e5
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
11 changes: 9 additions & 2 deletions geonode/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,11 +409,18 @@
}

# Documents application
ALLOWED_DOCUMENT_TYPES = [
try:
# try to parse python notation, default in dockerized env
ALLOWED_DOCUMENT_TYPES = ast.literal_eval(os.getenv('ALLOWED_DOCUMENT_TYPES'))
except ValueError:
# fallback to regular list of values separated with misc chars
ALLOWED_DOCUMENT_TYPES = [
'doc', 'docx', 'gif', 'jpg', 'jpeg', 'ods', 'odt', 'odp', 'pdf', 'png',
'ppt', 'pptx', 'rar', 'sld', 'tif', 'tiff', 'txt', 'xls', 'xlsx', 'xml',
'zip', 'gz', 'qml'
]
] if os.getenv('ALLOWED_DOCUMENT_TYPES') is None \
else re.split(r' *[,|:|;] *', os.getenv('ALLOWED_DOCUMENT_TYPES'))

MAX_DOCUMENT_SIZE = int(os.getenv('MAX_DOCUMENT_SIZE ', '2')) # MB

# DOCUMENT_TYPE_MAP and DOCUMENT_MIMETYPE_MAP update enumerations in
Expand Down
5 changes: 5 additions & 0 deletions scripts/docker/env/production/celery.env
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ HAYSTACK_ENGINE_URL=http://elasticsearch:9200/
HAYSTACK_ENGINE_INDEX_NAME=haystack
HAYSTACK_SEARCH_RESULTS_PER_PAGE=200

# ADDED - NEEDS RESET TO DEFAULT!
ALLOWED_DOCUMENT_TYPES=['doc', 'docx', 'gif', 'jpg', 'jpeg', 'ods', 'odt', 'odp', 'pdf', 'png','ppt', 'pptx', 'rar', 'sld', 'tif', 'tiff', 'txt', 'xls', 'xlsx', 'xml', 'zip', 'gz', 'qml', 'lyr', 'qlr']
MAX_DOCUMENT_SIZE=50
# ABOVE NEEDS RESET TO DEFAULT!

# GEOSERVER_ADMIN_PASSWORD=admin
# See https://github.com/geosolutions-it/geonode-generic/issues/28
# to see why we force API version to 1.24
Expand Down
6 changes: 6 additions & 0 deletions scripts/docker/env/production/django.env
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ HAYSTACK_ENGINE_URL=http://elasticsearch:9200/
HAYSTACK_ENGINE_INDEX_NAME=haystack
HAYSTACK_SEARCH_RESULTS_PER_PAGE=200


ALLOWED_DOCUMENT_TYPES=['doc', 'docx', 'gif', 'jpg', 'jpeg', 'ods', 'odt', 'odp', 'pdf', 'png','ppt', 'pptx', 'rar', 'sld', 'tif', 'tiff', 'txt', 'xls', 'xlsx', 'xml', 'zip', 'gz', 'qml']
MAX_DOCUMENT_SIZE=2



# GEOSERVER_ADMIN_PASSWORD=admin
# See https://github.com/geosolutions-it/geonode-generic/issues/28
# to see why we force API version to 1.24
Expand Down

0 comments on commit 72f80e5

Please sign in to comment.