Task #9553 Handle Environment Variables
This commit is contained in:
parent
8287e73f6b
commit
c4f7913cb1
4 changed files with 44 additions and 16 deletions
|
@ -14,6 +14,7 @@ parsedatetime
|
|||
pyparsing
|
||||
pydot
|
||||
django-extensions
|
||||
django-environ
|
||||
|
||||
# PDF creating
|
||||
django-hardcopy
|
||||
|
|
16
uncloud/.env-sample
Normal file
16
uncloud/.env-sample
Normal file
|
@ -0,0 +1,16 @@
|
|||
ALLOWED_HOSTS=
|
||||
STRIPE_KEY=
|
||||
STRIPE_PUBLIC_KEY=
|
||||
DATABASE_ENGINE=
|
||||
DATABASE_NAME=
|
||||
DATABASE_HOST=
|
||||
DATABASE_PORT=
|
||||
DATABASE_USER=
|
||||
DATABASE_PASSWORD=
|
||||
EMAIL_HOST=
|
||||
EMAIL_HOST_USER=
|
||||
EMAIL_HOST_PASSWORD=
|
||||
GITLAB_SERVER=
|
||||
GITLAB_OAUTH_TOKEN=
|
||||
GITLAB_AUTHOR_EMAIL=
|
||||
GITLAB_AUTHOR_NAME=
|
3
uncloud/.gitignore
vendored
3
uncloud/.gitignore
vendored
|
@ -1,2 +1,3 @@
|
|||
local_settings.py
|
||||
ldap_max_uid_file
|
||||
ldap_max_uid_file
|
||||
.env
|
|
@ -14,6 +14,7 @@ import os
|
|||
import re
|
||||
import ldap
|
||||
import sys
|
||||
import environ
|
||||
|
||||
from django.core.management.utils import get_random_secret_key
|
||||
from django_auth_ldap.config import LDAPSearch, LDAPSearchUnion
|
||||
|
@ -21,16 +22,25 @@ from django_auth_ldap.config import LDAPSearch, LDAPSearchUnion
|
|||
|
||||
LOGGING = {}
|
||||
|
||||
# Initialise environment variables
|
||||
env = environ.Env()
|
||||
environ.Env.read_env()
|
||||
|
||||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
sys.modules['fontawesome_free'] = __import__('fontawesome-free')
|
||||
|
||||
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
|
||||
'ENGINE': env('DATABASE_ENGINE'),
|
||||
'NAME': env('DATABASE_NAME') if env('DATABASE_NAME') else os.path.join(BASE_DIR, 'db.sqlite3'),
|
||||
'USER': env('DATABASE_USER'),
|
||||
'PASSWORD': env('DATABASE_PASSWORD'),
|
||||
'HOST': env('DATABASE_HOST'),
|
||||
'PORT': env('DATABASE_PORT'),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -188,11 +198,11 @@ STATICFILES_FINDERS = [
|
|||
]
|
||||
|
||||
#VM Deployment TEMPLATE
|
||||
GITLAB_SERVER = 'https://code.ungleich.ch'
|
||||
GITLAB_OAUTH_TOKEN = ''
|
||||
GITLAB_SERVER = env('GITLAB_SERVER')
|
||||
GITLAB_OAUTH_TOKEN = env('GITLAB_OAUTH_TOKEN')
|
||||
GITLAB_PROJECT_ID = 388
|
||||
GITLAB_AUTHOR_EMAIL = ''
|
||||
GITLAB_AUTHOR_NAME = ''
|
||||
GITLAB_AUTHOR_EMAIL = env('GITLAB_AUTHOR_EMAIL')
|
||||
GITLAB_AUTHOR_NAME = env('GITLAB_AUTHOR_NAME')
|
||||
GITLAB_YAML_DIR = ''
|
||||
|
||||
# XML-RPC interface of opennebula
|
||||
|
@ -202,13 +212,13 @@ OPENNEBULA_URL = 'https://opennebula.example.com:2634/RPC2'
|
|||
OPENNEBULA_USER_PASS = 'user:password'
|
||||
|
||||
# Stripe (Credit Card payments)
|
||||
STRIPE_KEY=""
|
||||
STRIPE_PUBLIC_KEY=""
|
||||
STRIPE_KEY=env('STRIPE_KEY')
|
||||
STRIPE_PUBLIC_KEY=env('STRIPE_PUBLIC_KEY')
|
||||
BILL_PAYMENT_DELAY = 0
|
||||
# The django secret key
|
||||
SECRET_KEY=get_random_secret_key()
|
||||
|
||||
ALLOWED_HOSTS = []
|
||||
ALLOWED_HOSTS = env('ALLOWED_HOSTS')
|
||||
|
||||
# required for hardcopy / pdf rendering: https://github.com/loftylabs/django-hardcopy
|
||||
CHROME_PATH = '/usr/bin/chromium-browser'
|
||||
|
@ -231,12 +241,12 @@ AUTH_LDAP_USER_SEARCH = LDAPSearch("dc=example,dc=com",
|
|||
LDAP_CUSTOMER_DN="ou=customer,dc=example,dc=com"
|
||||
|
||||
EMAIL_USE_TLS = True
|
||||
EMAIL_HOST = ''
|
||||
EMAIL_PORT = 465
|
||||
EMAIL_HOST_USER = DEFAULT_FROM_EMAIL = ''
|
||||
EMAIL_HOST_PASSWORD = ''
|
||||
DEFAULT_FROM_EMAIL = ''
|
||||
RENEWAL_FROM_EMAIL = 'test@example.com'
|
||||
EMAIL_HOST = env('EMAIL_HOST')
|
||||
EMAIL_PORT = 25
|
||||
EMAIL_HOST_USER = DEFAULT_FROM_EMAIL = env('EMAIL_HOST_USER')
|
||||
EMAIL_HOST_PASSWORD = env('EMAIL_HOST_PASSWORD')
|
||||
DEFAULT_FROM_EMAIL = 'support@ungleich.ch'
|
||||
RENEWAL_FROM_EMAIL = 'support@ungleich.ch'
|
||||
# Should be removed in production
|
||||
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
|
||||
|
||||
|
|
Loading…
Reference in a new issue