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-13 18:58:09 +00:00
|
|
|
settings.Key, err = ReadFromFile(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-13 18:59:07 +00:00
|
|
|
settings.Cert, err = ReadFromFile(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
|
|
|
|
|
}
|