Skip to content

Commit

Permalink
Make ACL policy part of the config struct
Browse files Browse the repository at this point in the history
  • Loading branch information
kradalby committed May 31, 2022
1 parent 5bfae22 commit 24e4787
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ type Config struct {
LogTail LogTailConfig

CLI CLIConfig

ACL ACLConfig
}

type OIDCConfig struct {
Expand Down Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions cmd/headscale/cli/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down Expand Up @@ -397,6 +405,8 @@ func GetHeadscaleConfig() headscale.Config {
Timeout: viper.GetDuration("cli.timeout"),
Insecure: viper.GetBool("cli.insecure"),
},

ACL: GetACLConfig(),
}
}

Expand Down

0 comments on commit 24e4787

Please sign in to comment.