From d3a218e73de35d2c798399f7781446c47202e468 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 9 Jul 2020 03:37:05 -0600 Subject: [PATCH] add more ENVs --- cmd/telebit/telebit.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/cmd/telebit/telebit.go b/cmd/telebit/telebit.go index 903968a..6190366 100644 --- a/cmd/telebit/telebit.go +++ b/cmd/telebit/telebit.go @@ -96,6 +96,14 @@ func main() { if *acmeStaging { *acmeDirectory = certmagic.LetsEncryptStagingCA } + if !*acmeAgree { + if "true" == os.Getenv("ACME_AGREE") { + *acmeAgree = true + } + } + if 0 == len(*email) { + *email = os.Getenv("ACME_EMAIL") + } if 0 == len(*locals) { *locals = os.Getenv("LOCALS") @@ -172,7 +180,10 @@ func main() { } } if 0 == len(*acmeRelay) { - *acmeRelay = strings.Replace(*relay, "ws", "http", 1) // "https://example.com:443" + *acmeRelay = os.Getenv("ACME_RELAY_URL") + } + if 0 == len(*acmeRelay) { + *acmeRelay = strings.Replace(*relay, "ws", "http", 1) + "/dns" // "https://example.com:443" } if 0 == len(*authURL) { @@ -183,6 +194,8 @@ func main() { *authURL = strings.Replace(*relay, "ws", "http", 1) // "https://example.com:443" } // TODO look at relay rather than authURL? + fmt.Println("Auth URL", *authURL) + authorizer = NewAuthorizer(*authURL) grants, err := telebit.Inspect(*authURL, *token) if nil != err { _, err := mgmt.Register(*authURL, *secret, ppid)