Make ACL policy part of the config struct
This commit is contained in:
parent
5bfae22c8f
commit
24e4787a64
2 changed files with 16 additions and 0 deletions
6
app.go
6
app.go
|
@ -116,6 +116,8 @@ type Config struct {
|
|||
LogTail LogTailConfig
|
||||
|
||||
CLI CLIConfig
|
||||
|
||||
ACL ACLConfig
|
||||
}
|
||||
|
||||
type OIDCConfig struct {
|
||||
|
@ -152,6 +154,10 @@ type CLIConfig struct {
|
|||
Insecure bool
|
||||
}
|
||||
|
||||
type ACLConfig struct {
|
||||
PolicyPath string
|
||||
}
|
||||
|
||||
// Headscale represents the base app of the service.
|
||||
type Headscale struct {
|
||||
cfg Config
|
||||
|
|
|
@ -177,6 +177,14 @@ func GetLogTailConfig() headscale.LogTailConfig {
|
|||
}
|
||||
}
|
||||
|
||||
func GetACLConfig() headscale.ACLConfig {
|
||||
policyPath := viper.GetString("acl_policy_path")
|
||||
|
||||
return headscale.ACLConfig{
|
||||
PolicyPath: policyPath,
|
||||
}
|
||||
}
|
||||
|
||||
func GetDNSConfig() (*tailcfg.DNSConfig, string) {
|
||||
if viper.IsSet("dns_config") {
|
||||
dnsConfig := &tailcfg.DNSConfig{}
|
||||
|
@ -397,6 +405,8 @@ func GetHeadscaleConfig() headscale.Config {
|
|||
Timeout: viper.GetDuration("cli.timeout"),
|
||||
Insecure: viper.GetBool("cli.insecure"),
|
||||
},
|
||||
|
||||
ACL: GetACLConfig(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue