From 61d9f241b991bccaa8b82eeee712b49b233d4e2f Mon Sep 17 00:00:00 2001 From: Alan Lam Date: Sun, 24 Nov 2019 09:32:08 -0800 Subject: [PATCH] Adds am_lighthouse warning msg (#43) * add warning message when am_lighthouse is enabled; update config templating --- .../ansible/roles/nebula/templates/config.yml.j2 | 2 ++ main.go | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/examples/quickstart-vagrant/ansible/roles/nebula/templates/config.yml.j2 b/examples/quickstart-vagrant/ansible/roles/nebula/templates/config.yml.j2 index 708409a..86a1b63 100644 --- a/examples/quickstart-vagrant/ansible/roles/nebula/templates/config.yml.j2 +++ b/examples/quickstart-vagrant/ansible/roles/nebula/templates/config.yml.j2 @@ -42,8 +42,10 @@ lighthouse: am_lighthouse: false {% endif %} interval: 60 +{% if 'generic' in group_names %} hosts: - {{ hostvars[groups['lighthouse'][0]][vagrant_ifce]['ipv4']['address'] | to_nebula_ip }} +{% endif %} # Configure the private interface tun: diff --git a/main.go b/main.go index c101774..f835aea 100644 --- a/main.go +++ b/main.go @@ -188,6 +188,13 @@ func Main(configPath string, configTest bool, buildVersion string) { punchBack := config.GetBool("punch_back", false) amLighthouse := config.GetBool("lighthouse.am_lighthouse", false) + + // warn if am_lighthouse is enabled but upstream lighthouses exists + lighthouseHosts := config.GetStringSlice("lighthouse.hosts", []string{}) + if amLighthouse && len(lighthouseHosts) != 0 { + l.Warn("lighthouse.am_lighthouse enabled on node but upstream lighthouses exist in config") + } + serveDns := config.GetBool("lighthouse.serve_dns", false) lightHouse := NewLightHouse( amLighthouse,