add more ENVs

This commit is contained in:
AJ ONeal 2020-07-09 03:37:05 -06:00
parent d3f8b90e32
commit d3a218e73d
1 changed files with 14 additions and 1 deletions

View File

@ -96,6 +96,14 @@ func main() {
if *acmeStaging { if *acmeStaging {
*acmeDirectory = certmagic.LetsEncryptStagingCA *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) { if 0 == len(*locals) {
*locals = os.Getenv("LOCALS") *locals = os.Getenv("LOCALS")
@ -172,7 +180,10 @@ func main() {
} }
} }
if 0 == len(*acmeRelay) { 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) { if 0 == len(*authURL) {
@ -183,6 +194,8 @@ func main() {
*authURL = strings.Replace(*relay, "ws", "http", 1) // "https://example.com:443" *authURL = strings.Replace(*relay, "ws", "http", 1) // "https://example.com:443"
} }
// TODO look at relay rather than authURL? // TODO look at relay rather than authURL?
fmt.Println("Auth URL", *authURL)
authorizer = NewAuthorizer(*authURL)
grants, err := telebit.Inspect(*authURL, *token) grants, err := telebit.Inspect(*authURL, *token)
if nil != err { if nil != err {
_, err := mgmt.Register(*authURL, *secret, ppid) _, err := mgmt.Register(*authURL, *secret, ppid)