2021-08-18 20:23:50 +00:00
|
|
|
package config
|
2020-02-06 20:42:46 -05:00
|
|
|
|
|
|
|
|
import (
|
2021-07-23 16:06:19 +00:00
|
|
|
"github.com/qdm12/gluetun/internal/constants"
|
2020-02-06 20:42:46 -05:00
|
|
|
"github.com/qdm12/golibs/command"
|
|
|
|
|
"github.com/qdm12/golibs/logging"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type Configurator interface {
|
2021-07-26 16:03:04 +00:00
|
|
|
VersionGetter
|
|
|
|
|
AuthWriter
|
|
|
|
|
Starter
|
2021-08-18 20:23:50 +00:00
|
|
|
Writer
|
2020-02-06 20:42:46 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type configurator struct {
|
2021-07-23 16:06:19 +00:00
|
|
|
logger logging.Logger
|
2021-07-24 17:59:22 +00:00
|
|
|
cmder command.RunStarter
|
2021-08-18 15:35:07 +00:00
|
|
|
configPath string
|
2021-07-23 16:06:19 +00:00
|
|
|
authFilePath string
|
2021-08-18 15:44:58 +00:00
|
|
|
puid, pgid int
|
2020-02-06 20:42:46 -05:00
|
|
|
}
|
|
|
|
|
|
2021-08-18 15:31:08 +00:00
|
|
|
func NewConfigurator(logger logging.Logger,
|
2021-08-18 15:44:58 +00:00
|
|
|
cmder command.RunStarter, puid, pgid int) Configurator {
|
2020-02-06 20:42:46 -05:00
|
|
|
return &configurator{
|
2021-07-23 16:06:19 +00:00
|
|
|
logger: logger,
|
2021-07-24 17:59:22 +00:00
|
|
|
cmder: cmder,
|
2021-08-18 15:35:07 +00:00
|
|
|
configPath: constants.OpenVPNConf,
|
2021-07-23 16:06:19 +00:00
|
|
|
authFilePath: constants.OpenVPNAuthConf,
|
2021-08-18 15:44:58 +00:00
|
|
|
puid: puid,
|
|
|
|
|
pgid: pgid,
|
2020-02-06 20:42:46 -05:00
|
|
|
}
|
|
|
|
|
}
|