Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor ColdFront settings #264

Merged
merged 37 commits into from
Mar 2, 2021
Merged

Refactor ColdFront settings #264

merged 37 commits into from
Mar 2, 2021

Conversation

aebruno
Copy link
Member

@aebruno aebruno commented Feb 28, 2021

Refactor ColdFront settings.

This PR attempts to better organize ColdFront settings and configuration. As the number of plugins grows having a well defined way to configure the ColdFront application will be imperative. The main goals are:

  1. Split the config/settings across multiple files for better organization.
  2. Allow configuring ColdFront from environment variables or a env file
  3. Enable easy way to set custom config values system wide for production installs as well as dev/staging environments

In this commit we use django-environ to fetch config settings from the environment. We also use django-split-settings which provides a way to split up django settings across multiple files.

The organization is as follows:

  • coldfront/config/base.py = Base Django config settings
  • coldfront/config/auth.py = Authentication backends
  • coldfront/config/database.py = Database backends
  • coldfront/config/email.py = Email settings
  • coldfront/config/logging.py = Logging settings
  • coldfront/config/core.py = Core ColdFront settings
  • coldfront/config/plugins/* = ColdFront Plugins

Sites can override any config settings by creating a local_settings.py file in coldfront/config, or /etc/coldfront/local_settings.py. Additionally, they can override settings using environment variables, or an environment file. ColdFront will search for environment files in this order: .env (in coldfront project directory) or /etc/coldfront/coldfront.env. You can also specify the path to the environment file using COLDFRONT_ENV.

This commit attempts to better organize ColdFront settings and
configuration. As the number of plugins grows having a well defined way
to configure the ColdFront application will be imperative. The main
goals are:

1. Split the config/settings across multiple files for better
organization.

2. Allow configuring ColdFront from environment variables or a env file

3. Enable easy way to set custom config values system wide for
production installs as well as dev/staging environments

In this commit we use django-environ to fetch config settings from the
environment. We also use django-split-settings which provides a way to
split up django settings across multiple files.

The organization is as follows:

- coldfront/config/base.py = Base Django config settings
- coldfront/config/auth.py = Authenication backends
- coldfront/config/database.py = Database backends
- coldfront/config/email.py = Email settings
- coldfront/config/logging.py = Logging settings
- coldfront/config/core.py = Core ColdFront settings
- coldfront/config/plugins/* = ColdFront Plugins

Sites can override any config settings by creating a local_settings.py
file in coldfront/config, or /etc/coldfront/local_settings.py.
Additionally, they can override settings using environment variables, or
an environment file. ColdFront will search for environment files in this
order: .env (in current working directory) or
/etc/coldfront/coldfront.env. You can also specify the path to the
environment file using COLDFRONT_ENV.
@aebruno aebruno requested a review from dsajdak February 28, 2021 03:36
@aebruno aebruno changed the title WIP: Refactor ColdFront settings Refactor ColdFront settings Mar 1, 2021
@aebruno aebruno marked this pull request as ready for review March 1, 2021 02:16
docs/pages/config.md Outdated Show resolved Hide resolved
docs/pages/config.md Outdated Show resolved Hide resolved
docs/pages/config.md Outdated Show resolved Hide resolved
docs/pages/config.md Outdated Show resolved Hide resolved
docs/pages/config.md Outdated Show resolved Hide resolved
docs/pages/install.md Outdated Show resolved Hide resolved
Copy link
Contributor

@dsajdak dsajdak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great except these couple of typos. Tested in staging all all functionality appears to work as before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants