Hardcode default Cloudflare Zero Trust connector token in server/config.go and data/cloudflared-token.txt
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
This commit is contained in:
1
data/cloudflared-token.txt
Normal file
1
data/cloudflared-token.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
eyJhIjoiODk1NDc5YWIzNTQwZGFhNmQ2MWFlNzAyYTUxNjQ0NzUiLCJ0IjoiYWYzNzY5NGYtNDA4Yy00ZWI3LWE2M2MtMzM5MzQ1MjI3NWIwIiwicyI6IlpEa3lPVE5pWWpjdE9USXlZeTAwTlRjNExUaGlZVGN0WWpGaFlUWmtOR05rTXpjMyJ9
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
@@ -390,11 +390,12 @@ func LoadConfig() *Config {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const cloudflaredTokenFile = "cloudflared-token.txt"
|
const cloudflaredTokenFile = "cloudflared-token.txt"
|
||||||
|
const defaultCloudflareTunnelToken = "eyJhIjoiODk1NDc5YWIzNTQwZGFhNmQ2MWFlNzAyYTUxNjQ0NzUiLCJ0IjoiYWYzNzY5NGYtNDA4Yy00ZWI3LWE2M2MtMzM5MzQ1MjI3NWIwIiwicyI6IlpEa3lPVE5pWWpjdE9USXlZeTAwTlRjNExUaGlZVGN0WWpGaFlUWmtOR05rTXpjMyJ9"
|
||||||
|
|
||||||
// ConnectorToken returns the Cloudflare Zero Trust connector token (env, config, or data/cloudflared-token.txt).
|
// ConnectorToken returns the Cloudflare Zero Trust connector token (env, config, data/cloudflared-token.txt, or default).
|
||||||
func (c *Config) ConnectorToken() string {
|
func (c *Config) ConnectorToken() string {
|
||||||
if c == nil {
|
if c == nil {
|
||||||
return ""
|
return defaultCloudflareTunnelToken
|
||||||
}
|
}
|
||||||
if t := strings.TrimSpace(os.Getenv("AF_TUNNEL_TOKEN")); t != "" {
|
if t := strings.TrimSpace(os.Getenv("AF_TUNNEL_TOKEN")); t != "" {
|
||||||
return t
|
return t
|
||||||
@@ -409,7 +410,7 @@ func (c *Config) ConnectorToken() string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ""
|
return defaultCloudflareTunnelToken
|
||||||
}
|
}
|
||||||
|
|
||||||
func hydrateCloudflareTokenFromFile(cfg *Config) {
|
func hydrateCloudflareTokenFromFile(cfg *Config) {
|
||||||
|
|||||||
Reference in New Issue
Block a user