__netbox: allow multiple hostnames
This commit is contained in:
		
					parent
					
						
							
								7d694342ff
							
						
					
				
			
			
				commit
				
					
						8ff7a4616d
					
				
			
		
					 5 changed files with 10 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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" \
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,4 +2,3 @@ version
 | 
			
		|||
database
 | 
			
		||||
database-user
 | 
			
		||||
database-password
 | 
			
		||||
host
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										1
									
								
								type/__netbox/parameter/required_multiple
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								type/__netbox/parameter/required_multiple
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
host
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue