From 24e4787a64d05e93c0028b6055c2fb77791d11f1 Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Tue, 31 May 2022 12:50:16 +0200 Subject: [PATCH] Make ACL policy part of the config struct --- app.go | 6 ++++++ cmd/headscale/cli/utils.go | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/app.go b/app.go index cc4728d3..cc867a40 100644 --- a/app.go +++ b/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 diff --git a/cmd/headscale/cli/utils.go b/cmd/headscale/cli/utils.go index 797fba1a..2c0eb0a4 100644 --- a/cmd/headscale/cli/utils.go +++ b/cmd/headscale/cli/utils.go @@ -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(), } }