2022-01-06 06:40:23 -05:00
|
|
|
package files
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
|
|
"github.com/qdm12/gluetun/internal/configuration/settings"
|
2022-01-29 15:34:59 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
// OpenVPNClientKeyPath is the OpenVPN client key filepath.
|
|
|
|
|
OpenVPNClientKeyPath = "/gluetun/client.key"
|
|
|
|
|
// OpenVPNClientCertificatePath is the OpenVPN client certificate filepath.
|
|
|
|
|
OpenVPNClientCertificatePath = "/gluetun/client.crt"
|
2022-01-06 06:40:23 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func (r *Reader) readOpenVPN() (settings settings.OpenVPN, err error) {
|
2022-08-24 19:31:52 +00:00
|
|
|
settings.ClientKey, err = readPEMFile(OpenVPNClientKeyPath)
|
2022-01-06 06:40:23 -05:00
|
|
|
if err != nil {
|
2022-02-20 02:58:16 +00:00
|
|
|
return settings, fmt.Errorf("client key: %w", err)
|
2022-01-06 06:40:23 -05:00
|
|
|
}
|
|
|
|
|
|
2022-08-24 19:31:52 +00:00
|
|
|
settings.ClientCrt, err = readPEMFile(OpenVPNClientCertificatePath)
|
2022-01-06 06:40:23 -05:00
|
|
|
if err != nil {
|
2022-02-20 02:58:16 +00:00
|
|
|
return settings, fmt.Errorf("client certificate: %w", err)
|
2022-01-06 06:40:23 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return settings, nil
|
|
|
|
|
}
|