Rename scheme to internalScheme

This commit is contained in:
Jean Froment 2022-03-06 20:52:50 +01:00
parent 18caa638bd
commit 75edd0940d
3 changed files with 8 additions and 8 deletions

View File

@ -85,8 +85,8 @@ cat services.conf | while read line || [[ -n $line ]]; do
;; ;;
esac esac
# Define scheme // For nextcloud, scheme must be https # Define scheme // For nextcloud, scheme must be https
scheme="http" internalScheme="http"
[[ $key == "nextcloud" ]] && scheme="https" [[ $key == "nextcloud" ]] && internalScheme="https"
# Define service default port from bundled config file # Define service default port from bundled config file
internalPort=$(cat config/ports | { grep $key || true; } | sed -r "s/^${key}: (.*)$/\1/") internalPort=$(cat config/ports | { grep $key || true; } | sed -r "s/^${key}: (.*)$/\1/")
@ -95,7 +95,7 @@ cat services.conf | while read line || [[ -n $line ]]; do
"host": "'"$key"'.'$(echo '${TRAEFIK_DOMAIN}')'", "host": "'"$key"'.'$(echo '${TRAEFIK_DOMAIN}')'",
"httpAuth": '"${defaultHttpAuth}"', "httpAuth": '"${defaultHttpAuth}"',
"internalPort": '"${internalPort}"', "internalPort": '"${internalPort}"',
"scheme": "'"${scheme}"'" "internalScheme": "'"${internalScheme}"'"
} }
]') ]')
;; ;;

View File

@ -17,7 +17,7 @@ services:
httpAuth: true httpAuth: true
internalPort: 8112 internalPort: 8112
# Uncomment to specify custom schme (http by default) # Uncomment to specify custom schme (http by default)
# scheme: http # internalScheme: http
# Uncomment to *NOT* generate LetsEncrypt certificate (useful for local domains) # Uncomment to *NOT* generate LetsEncrypt certificate (useful for local domains)
# disableCertificateGeneration: true # disableCertificateGeneration: true
- name: flood - name: flood

View File

@ -208,9 +208,9 @@ for json in $(yq eval -o json config.yaml | jq -c ".services[]"); do
[[ ${vpn} == "true" ]] && backendHost="gluetun" [[ ${vpn} == "true" ]] && backendHost="gluetun"
# Handle custom scheme (default if non-specified is http) # Handle custom scheme (default if non-specified is http)
scheme="http" internalScheme="http"
customScheme=$(echo $rule | jq -r .scheme) customInternalScheme=$(echo $rule | jq -r .internalScheme)
[[ ${customScheme} != "null" ]] && scheme=${customScheme} [[ ${customInternalScheme} != "null" ]] && internalScheme=${customInternalScheme}
# Transform the bash syntax into Traefik/go one => anything.${TRAEFIK_DOMAIN} to anything.{{ env "TRAEFIK_DOMAIN" }} # Transform the bash syntax into Traefik/go one => anything.${TRAEFIK_DOMAIN} to anything.{{ env "TRAEFIK_DOMAIN" }}
hostTraefik=$(echo ${host} | sed --regexp-extended 's/^(.*)(\$\{(.*)\})/\1\{\{ env "\3" \}\}/') hostTraefik=$(echo ${host} | sed --regexp-extended 's/^(.*)(\$\{(.*)\})/\1\{\{ env "\3" \}\}/')
@ -236,7 +236,7 @@ for json in $(yq eval -o json config.yaml | jq -c ".services[]"); do
# If the specified service does not contain a "@" => we create it # If the specified service does not contain a "@" => we create it
# If the service has a @, it means it is defined elsewhere so we do not create it (custom file, @internal...) # If the service has a @, it means it is defined elsewhere so we do not create it (custom file, @internal...)
if echo ${traefikService} | grep -vq "@"; then if echo ${traefikService} | grep -vq "@"; then
echo "http.services.${ruleId}.loadBalancer.servers.0.url: ${scheme}://${backendHost}:${internalPort}" >> rules.props echo "http.services.${ruleId}.loadBalancer.servers.0.url: ${internalScheme}://${backendHost}:${internalPort}" >> rules.props
fi fi
done done