Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
GraceDB Server
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michael William Coughlin
GraceDB Server
Commits
fc123730
Commit
fc123730
authored
6 years ago
by
Tanner Prestegard
Committed by
GraceDB
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add function to settings for getting environment variables
parent
e6a41f4d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
config/settings/base.py
+9
-0
9 additions, 0 deletions
config/settings/base.py
with
9 additions
and
0 deletions
config/settings/base.py
+
9
−
0
View file @
fc123730
...
...
@@ -3,6 +3,7 @@ from datetime import datetime, timedelta
import
os
,
time
,
logging
from
os.path
import
abspath
,
dirname
,
join
import
socket
from
django.core.exceptions
import
ImproperlyConfigured
# Set up path to root of project
BASE_DIR
=
abspath
(
join
(
dirname
(
__file__
),
"
..
"
,
"
..
"
))
...
...
@@ -12,6 +13,14 @@ PROJECT_ROOT = join(BASE_DIR, "gracedb")
# Other useful paths
PROJECT_DATA_DIR
=
join
(
BASE_DIR
,
"
..
"
,
"
project_data
"
)
# Useful function for getting environment variables
def
get_from_env
(
envvar
,
default_value
=
None
,
fail_if_not_found
=
True
):
value
=
os
.
environ
.
get
(
envvar
,
default_value
)
if
(
value
==
default_value
and
fail_if_not_found
):
raise
ImproperlyConfigured
(
'
Could not get environment variable {0}
'
.
format
(
envvar
))
return
value
# Unauthenticated access ------------------------------------------------------
# This variable controls whether unauthenticated access is allowed *ANYWHERE*
# on this service, except the home page, which is always public.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment