feat: CI local_settings.py loads config from env vars
ci/woodpecker/push/woodpecker Pipeline failed Details

wip-infra-tests
Aravinth Manivannan 2022-06-27 02:44:49 +05:30
parent 243880f6cc
commit 6388e4de10
Signed by: realaravinth
GPG Key ID: AD9F0F08E855ED88
2 changed files with 87 additions and 0 deletions

View File

@ -0,0 +1,85 @@
"""
Django settings for dashboard project.
Generated by 'django-admin startproject' using Django 4.0.3.
For more information on this file, see
https://docs.djangoproject.com/en/4.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.0/ref/settings/
"""
import environ
import os
env = environ.Env()
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
# A new SECRET_KEY can be generated by running the following command:
# openssl rand -hex 32
SECRET_KEY = "django-insecure-44zt@)$td7_yh(01q^hrce%h(311n!djn%%#s1b7$cvfy!pf7y"
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Database
# https://docs.djangoproject.com/en/4.0/ref/settings/#databases
DATABASES = {
"default": env.db_url(
"DATABSE_URL", default="postgres://postgres:password@localhost:5432/postgres"
)
}
## django-payments configuration
PAYMENT_HOST = "http://localhost:8000"
PAYMENT_VARIANTS = {
"stripe": (
"payments.stripe.StripeProvider", # please don't change this
{
"secret_key": env.get_value("STRIPE_SECRET_KEY"),
"public_key": env.get_value("STRIPE_PUBLIC_KEY"),
},
)
}
### Dashbaord specific configuration options
HOSTEA = {
"INSTANCE_MAINTAINER_CONTACT": "contact@hostea.example.org",
"ACCOUNTS": {
"MAX_VERIFICATION_TOLERANCE_PERIOD": 60 * 60 * 24, # in seconds
"SUDO_TTL": 60 * 5,
},
"META": {
"GITEA_INSTANCE": env.get_value("HOSTEA_META_GITEA_INSTANCE"), # meta Gitea insatnce
"GITEA_ORG_NAME": "Hostea", # Organisation name on Hostea meta instance
# Repository dedicated for handling support
# ref: https://gitea.hostea.org/Hostea/july-mvp/issues/17
"SUPPORT_REPOSITORY": "support",
},
"INFRA": {
"HOSTEA_REPO": {
# where to clone the repository
"PATH": "/tmp/hostea/dashboard/infrastructure",
# Git remote URI of the repository
"REMOTE": env.get_value("HOSTEA_INFRA_HOSTEA_REPO_REMOTE"),
# SSH key that can push to the Git repository remote mentioned above
"SSH_KEY": "tests/fleet-deploy-key",
}
},
}
# Please see EMAIL_* configuration options:
# https://docs.djangoproject.com/en/4.1/ref/settings/#email-host
EMAIL_CONFIG = env.email("EMAIL_URL", default="smtp://admin:password@localhost:10025")
vars().update(EMAIL_CONFIG)

View File

@ -15,6 +15,8 @@ main() {
docker_compose_up
setup_env
wait_for_env
else
cp dashboard/local_settings.ci.py dashboard/local_settings.py
fi
gitea_root
support_repo_init