__netbox: allow multiple hostnames

This commit is contained in:
matze 2020-08-25 19:30:32 +02:00
parent 7d694342ff
commit 8ff7a4616d
5 changed files with 10 additions and 4 deletions

View File

@ -11,7 +11,7 @@ cat << EOF
# access to the server via any other hostnames. The first FQDN in the list will be treated as the preferred name.
#
# Example: ALLOWED_HOSTS = ['netbox.example.com', 'netbox.internal.local']
ALLOWED_HOSTS = [ '$ALLOWED_HOST' ]
ALLOWED_HOSTS = [$ALLOWED_HOSTS ]
# PostgreSQL database configuration. See the Django documentation for a complete list of available parameters:
# https://docs.djangoproject.com/en/stable/ref/settings/#databases

View File

@ -34,6 +34,7 @@ database-password
host
Hostname (domain or IP address) on which the application is served.
Multiple hostnames are possible; given as multiple arguments.
OPTIONAL PARAMETERS
-------------------
@ -190,6 +191,7 @@ EXAMPLES
--database-password "secretsecretsecret" \
--secret-key "secretsecretsecret" \
--host "${__target_host:?}" \
--host "cool-netbox.xyz" \
--ldap-server "ldaps://ldap.domain.tld" \
--ldap-bind-dn "uid=netbox,ou=services,dc=domain,dc=tld" \
--ldap-bind-password "secretsecretsecret" \

View File

@ -35,8 +35,12 @@ export DATABASE_HOST
DATABASE_PORT="$(cat "$__object/parameter/database-port")"
export DATABASE_PORT
ALLOWED_HOST=$(cat "$__object/parameter/host")
export ALLOWED_HOST
# list of hosts
ALLOWED_HOSTS=""
while read -r hostname; do
ALLOWED_HOSTS="$ALLOWED_HOSTS '$hostname',"
done < "$__object/parameter/host"
export ALLOWED_HOSTS
if [ -f "$__object/parameter/secret-key" ]; then
SECRET_KEY=$(cat "$__object/parameter/secret-key")

View File

@ -2,4 +2,3 @@ version
database
database-user
database-password
host

View File

@ -0,0 +1 @@
host