mirror of
https://github.com/retspen/webvirtcloud
synced 2026-12-02 17:06:09 +00:00
feat: an installation's own settings in data/local_settings.py; settings.py is part of the code
Every update rebuilt settings.py from the template, and the operator put back their own values by reading a diff: a forgotten DATABASES started the panel on a new, empty sqlite database. Docker users who needed an option only settings.py has (LDAP, OTP_ENABLED, LOGIN_TRUSTED_PROXIES) mounted their own copy and kept it up to date by hand. webvirtcloud/settings.py is now the tracked file (no template, no copy in the installer, the image, the container's start or CI), and it runs data/local_settings.py last: the installation's own values, which an update does not touch, kept in Docker's data volume, in the panel's backups and readable by the panel's user only. The installer writes the time zone, the noVNC port (now checked to be a number), ALLOWED_HOSTS and CSRF_TRUSTED_ORIGINS there instead of editing settings.py with sed. LDAP is set up there too; settings.py keeps only python-ldap's timeouts. The README's update steps move an older version's own settings.py into the backup before git pull and have its values moved into the local file once.
This commit is contained in:
parent
0fb0b61a1a
commit
29a1cbcace
15 changed files with 221 additions and 180 deletions
13
.github/workflows/test.yml
vendored
13
.github/workflows/test.yml
vendored
|
|
@ -42,6 +42,7 @@ jobs:
|
|||
--health-retries 10
|
||||
|
||||
env:
|
||||
SECRET_KEY: ci-only-not-a-secret
|
||||
WEBVIRTCLOUD_DB_HOST: ${{ matrix.database == 'postgresql' && 'localhost' || '' }}
|
||||
WEBVIRTCLOUD_DB_PASSWORD: webvirtcloud
|
||||
|
||||
|
|
@ -79,12 +80,6 @@ jobs:
|
|||
python -m pip install --upgrade pip setuptools
|
||||
pip install -r dev/requirements.txt
|
||||
|
||||
- name: Configure WebVirtCloud Settings
|
||||
run: |
|
||||
cp webvirtcloud/settings.py.template webvirtcloud/settings.py
|
||||
SECRET_KEY=$(python -c 'import secrets; print(secrets.token_urlsafe(50))')
|
||||
sed -i "s|^SECRET_KEY = .*|SECRET_KEY = \"${SECRET_KEY}\"|" webvirtcloud/settings.py
|
||||
|
||||
- name: Check For Missing Migrations
|
||||
run: python manage.py makemigrations --check --dry-run
|
||||
|
||||
|
|
@ -152,8 +147,7 @@ jobs:
|
|||
- name: Plant Secret Sentinels
|
||||
run: |
|
||||
mkdir -p data
|
||||
for f in data/secret_key data/admin_password settings.py webvirtcloud/settings.py.bak \
|
||||
'webvirtcloud/settings.py~' webvirtcloud/.settings.py.swp; do
|
||||
for f in data/secret_key data/admin_password data/local_settings.py data/local_settings.py~ settings.py; do
|
||||
echo sentinel > "$f"
|
||||
done
|
||||
|
||||
|
|
@ -175,8 +169,7 @@ jobs:
|
|||
run: |
|
||||
docker run --rm --entrypoint sh webvirtcloud:ci -c '
|
||||
cd /srv/webvirtcloud
|
||||
for f in data/secret_key data/admin_password settings.py webvirtcloud/settings.py.bak \
|
||||
"webvirtcloud/settings.py~" webvirtcloud/.settings.py.swp; do
|
||||
for f in data/secret_key data/admin_password data/local_settings.py data/local_settings.py~ settings.py; do
|
||||
if [ -e "$f" ]; then echo "$f is in the image"; exit 1; fi
|
||||
done'
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue