|
| 1 | +# BCO DB Configuration |
| 2 | + |
| 3 | +Below is an example configuration file. This file contains sensitive information and deployment specific settings. Example values and specific instructions are given in each of the respective [deployment](docs/deployment) instructions. |
| 4 | + |
| 5 | +See the [Django docs](https://docs.djangoproject.com/en/5.0/ref/settings/) for more specific details. |
| 6 | +``` shell |
| 7 | +[DJANGO_KEYS] |
| 8 | +SECRET_KEY=^2uql114+yy0d$xv6+lm8*#1=uxs_oa0zw0bvu^fpi4tc9x0i |
| 9 | +ANON_KEY=627626823549f787c3ec763ff687169206626149 |
| 10 | + |
| 11 | +[SERVER] |
| 12 | +DEBUG=True |
| 13 | +ALLOWED_HOSTS=* |
| 14 | +SERVER_VERSION=24.06.13 |
| 15 | +HOSTNAME=127.0.0.1:8000 |
| 16 | +HUMAN_READABLE_HOSTNAME=DEV BCODB |
| 17 | +PUBLIC_HOSTNAME=http://127.0.0.1:8000 |
| 18 | +DATABASE=db.sqlite3 |
| 19 | +EMAIL_BACKEND=django.core.mail.backends.console.EmailBackend |
| 20 | +``` |
| 21 | + |
| 22 | + |
| 23 | +## DJANGO_KEYS: Keys and Tokens for Django |
| 24 | +### SECRET_KEY |
| 25 | +According to the Django docs the [SECRETE_KEY](https://docs.djangoproject.com/en/dev/ref/settings/#secret-key) is used for the following: |
| 26 | +- All sessions if you are using any other session backend than django.contrib.sessions.backends.cache, or are using the default get_session_auth_hash(). |
| 27 | +- All messages if you are using CookieStorage or FallbackStorage. |
| 28 | +- All PasswordResetView tokens. |
| 29 | +- Any usage of cryptographic signing, unless a different key is provided. |
| 30 | + |
| 31 | +If you rotate your secret key, all of the above will be invalidated. Secret keys are not used for passwords of users and key rotation will not affect them. |
| 32 | + |
| 33 | +### ANON_KEY |
| 34 | +The BCO DB uses Django REST framework's [TokenAuthentication](https://www.django-rest-framework.org/api-guide/authentication/#tokenauthentication) as one of the athentication schems. To allow access to *public* objects and information there is a default [AnonymousUser](https://docs.djangoproject.com/en/5.0/ref/contrib/auth/#anonymoususer-object) set. This is the token to be set for the `AnonymousUser`. |
| 35 | + |
| 36 | +## SERVER: Deployument specific settings |
| 37 | + |
| 38 | +### DEBUG |
| 39 | +Django's [DEBUG](https://docs.djangoproject.com/en/5.0/ref/settings/#debug) flag. |
| 40 | + |
| 41 | +It's a boolean that turns on/off debug mode, with the default as `False`. It is reccomended to never deploy a site into production with DEBUG turned on. |
| 42 | + |
| 43 | +### ALLOWED_HOSTS |
| 44 | + |
| 45 | +Django's [ALLOWED_HOSTS](https://docs.djangoproject.com/en/5.0/ref/settings/#allowed-hosts) list. Default is an empty list. |
| 46 | + |
| 47 | +"A list of strings representing the host/domain names that this Django site can serve. This is a security measure to prevent HTTP Host header attacks, which are possible even under many seemingly-safe web server configurations." |
| 48 | + |
| 49 | +### SERVER_VERSION |
| 50 | +The SERVER_VERSION is displayed on the Swagger Docs page. |
| 51 | + |
| 52 | +### HOSTNAME |
| 53 | +The HOSTNAME to be returnd in the `user_info` object. This is used by the BCO Portal for interacting with a specific instance of the BCO DB. |
| 54 | + |
| 55 | +### HUMAN_READABLE_HOSTNAME |
| 56 | +The HUMAN_READABLE_HOSTNAME to be returnd in the `user_info` object. This is used by the BCO Portal for interacting with a specific instance of the BCO DB, and in the Swager Docs. |
| 57 | + |
| 58 | +### PUBLIC_HOSTNAME |
| 59 | +The PUBLIC_HOSTNAME to be returnd in the `user_info` object. This is used by the BCO Portal for interacting with a specific instance of the BCO DB, and in the Swager Docs. It is also utilized by the `activation_link`, `retrieve_bco`, `validate_bco_object_id` functions, as well as in the API tests. |
| 60 | + |
| 61 | +### DATABASE |
| 62 | +This value is used as the `"NAME"`in Django's [DATABASES](https://docs.djangoproject.com/en/5.0/ref/settings/#databases) object. The BCO DB is set up to use the default SQLITE. If you would like to have a database that is outside of the project folder and/or has a non-default name than you can provide an absolute path for the name value here. |
| 63 | + |
| 64 | +### EMAIL_BACKEND |
| 65 | +Specifies which of Django's [EMAIL_BACKEND](https://docs.djangoproject.com/en/5.0/topics/email/#topic-email-backends) classes to use. |
| 66 | + |
| 67 | +This app has been tested using the `django.core.mail.backends.smtp.EmailBackend` with `sendmail` and a GMail account in production, and with `django.core.mail.backends.console.EmailBackend` in local deployments. |
0 commit comments