fix(settings): read PEM files but b64 env vars

- Extract base64 data from PEM files and secret files
- Environment variables are not PEM encoded and only the base64 data
- Affects OpenVPN certificate, key and encrypted key
This commit is contained in:
Quentin McGaw
2022-08-24 19:31:52 +00:00
parent 0413a0a1ab
commit 732f826ec2
8 changed files with 53 additions and 54 deletions

View File

@@ -24,7 +24,7 @@ func readOpenVPN() (
return settings, fmt.Errorf("cannot read password file: %w", err)
}
settings.ClientKey, err = readSecretFileAsStringPtr(
settings.ClientKey, err = readPEMSecretFile(
"OPENVPN_CLIENTKEY_SECRETFILE",
"/run/secrets/openvpn_clientkey",
)
@@ -32,7 +32,7 @@ func readOpenVPN() (
return settings, fmt.Errorf("cannot read client key file: %w", err)
}
settings.ClientCrt, err = readSecretFileAsStringPtr(
settings.ClientCrt, err = readPEMSecretFile(
"OPENVPN_CLIENTCRT_SECRETFILE",
"/run/secrets/openvpn_clientcrt",
)