Retrocompatiblity with EXTRA_SUBNETS key

This commit is contained in:
Quentin McGaw
2020-10-29 23:32:15 +00:00
parent db64dea664
commit 58da55da1e
4 changed files with 17 additions and 2 deletions

View File

@@ -4,13 +4,19 @@ import (
"fmt"
"net"
"strings"
libparams "github.com/qdm12/golibs/params"
)
// GetOutboundSubnets obtains the CIDR subnets from the comma separated list of the
// environment variable FIREWALL_OUTBOUND_SUBNETS.
func (r *reader) GetOutboundSubnets() (outboundSubnets []net.IPNet, err error) {
const key = "FIREWALL_OUTBOUND_SUBNETS"
s, err := r.envParams.GetEnv(key)
retroOption := libparams.RetroKeys(
[]string{"EXTRA_SUBNETS"},
r.onRetroActive,
)
s, err := r.envParams.GetEnv(key, retroOption)
if err != nil {
return nil, err
} else if s == "" {