Files
gluetun/internal/configuration/sources/files/openvpn.go
Quentin McGaw c73369e11c chore(constants): remove and move constant paths
- Remove unused paths
- Move paths to inline constants if used only once
2022-02-06 19:59:07 +00:00

29 lines
752 B
Go

package files
import (
"fmt"
"github.com/qdm12/gluetun/internal/configuration/settings"
)
const (
// OpenVPNClientKeyPath is the OpenVPN client key filepath.
OpenVPNClientKeyPath = "/gluetun/client.key"
// OpenVPNClientCertificatePath is the OpenVPN client certificate filepath.
OpenVPNClientCertificatePath = "/gluetun/client.crt"
)
func (r *Reader) readOpenVPN() (settings settings.OpenVPN, err error) {
settings.ClientKey, err = ReadFromFile(OpenVPNClientKeyPath)
if err != nil {
return settings, fmt.Errorf("cannot read client key: %w", err)
}
settings.ClientCrt, err = ReadFromFile(OpenVPNClientCertificatePath)
if err != nil {
return settings, fmt.Errorf("cannot read client certificate: %w", err)
}
return settings, nil
}