@@ -8,16 +8,15 @@ info "Starting certificate renewal process"
88
99# If we have a config file we parse it and let definitions within take
1010# precedence over any environment variables.
11- config_file=" ${NGINX_CERTBOT_CONFIG_FILE:-/ etc/ nginx-certbot/ config.yml} "
12- if [ -f " ${config_file} " ]; then
13- certbot_authenticator=" $( shyaml get-value certbot.authenticator ' ' < " ${config_file} " ) "
14- certbot_elliptic_curve=" $( shyaml get-value certbot.elliptic-curve ' ' < " ${config_file} " ) "
15- certbot_email=" $( shyaml get-value certbot.email ' ' < " ${config_file} " ) "
16- certbot_key_type=" $( shyaml get-value certbot.key-type ' ' < " ${config_file} " ) "
17- certbot_rsa_key_size=" $( shyaml get-value certbot.rsa-key-size ' ' < " ${config_file} " ) "
18- certbot_staging=" $( shyaml get-value certbot.staging ' ' < " ${config_file} " ) "
19- certbot_production_url=" $( shyaml get-value certbot.production_url ' ' < " ${config_file} " ) "
20- certbot_staging_url=" $( shyaml get-value certbot.staging_url ' ' < " ${config_file} " ) "
11+ if [ -f " ${CONFIG_FILE} " ]; then
12+ certbot_authenticator=" $( shyaml get-value certbot.authenticator ' ' < " ${CONFIG_FILE} " ) "
13+ certbot_elliptic_curve=" $( shyaml get-value certbot.elliptic-curve ' ' < " ${CONFIG_FILE} " ) "
14+ certbot_email=" $( shyaml get-value certbot.email ' ' < " ${CONFIG_FILE} " ) "
15+ certbot_key_type=" $( shyaml get-value certbot.key-type ' ' < " ${CONFIG_FILE} " ) "
16+ certbot_rsa_key_size=" $( shyaml get-value certbot.rsa-key-size ' ' < " ${CONFIG_FILE} " ) "
17+ certbot_staging=" $( shyaml get-value certbot.staging ' ' < " ${CONFIG_FILE} " ) "
18+ certbot_production_url=" $( shyaml get-value certbot.production_url ' ' < " ${CONFIG_FILE} " ) "
19+ certbot_staging_url=" $( shyaml get-value certbot.staging_url ' ' < " ${CONFIG_FILE} " ) "
2120fi
2221
2322# Environment variable fallbacks
@@ -135,19 +134,19 @@ get_certificate() {
135134# If we have a config file we request certificates based on the specifications
136135# within that file otherwise we parse the nginx config files to automatically
137136# discover certificate names, key types, authenticators, and domains.
138- if [ -f " ${config_file } " ]; then
139- debug " Using config file '${config_file } ' for certificate specifications"
137+ if [ -f " ${CONFIG_FILE } " ]; then
138+ debug " Using config file '${CONFIG_FILE } ' for certificate specifications"
140139 # Loop over the certificates array and request the certificates
141140 while read -r -d ' ' cert; do
142141 debug " Parsing certificate specification"
143142
144- # cert- name (required)
145- cert_name=" $( shyaml get-value cert- name ' ' <<< " ${cert}" ) "
143+ # name (required)
144+ cert_name=" $( shyaml get-value name ' ' <<< " ${cert}" ) "
146145 if [ -z " ${cert_name} " ]; then
147- error " 'cert- name' is missing; ignoring this certificate specification"
146+ error " 'name' is missing; ignoring this certificate specification"
148147 continue
149148 fi
150- debug " Certificate cert- name is: ${cert_name} "
149+ debug " Certificate name is: ${cert_name} "
151150
152151 # domains (required)
153152 domains=()
@@ -190,7 +189,7 @@ if [ -f "${config_file}" ]; then
190189 if ! get_certificate " ${cert_name} " " ${domain_request} " " ${key_type} " " ${authenticator} " " ${rsa_key_size} " " ${elliptic_curve} " " ${credentials} " ; then
191190 error " Certbot failed for '${cert_name} '. Check the logs for details."
192191 fi
193- done < <( shyaml -y get-values-0 certificates ' ' < ${config_file} )
192+ done < <( shyaml -y get-values-0 certificates ' ' < " ${CONFIG_FILE} " )
194193else
195194 debug " Using automatic discovery of nginx conf file for certificate specifications"
196195 # This will return an associative array that looks something like this:
0 commit comments