ix ckpool.conf render dropping the TLS bind port; Let deployments declare what each stratum bind is

This commit is contained in:
2026-08-01 06:22:11 +03:00
parent 2c4c6609ba
commit 8a35b02c7e
10 changed files with 159 additions and 45 deletions
+18 -10
View File
@@ -39,21 +39,29 @@ type Config struct {
// the UI uses the public mempool.space; non-empty means the user
// has pointed Kamado at their own instance via the StartOS config.
MempoolBaseURL string
// Optional JSON array describing ckpool's serverurl[] binds, so the
// dashboard can name the transport a miner connected over instead of
// guessing from the bind index. Rendered by whoever writes
// ckpool.conf; empty means "undeclared" and the UI falls back. Parsed
// in main (the concrete type lives with the snapshot it belongs to).
StratumServersJSON string
}
func FromEnv() (*Config, error) {
cfg := &Config{
ListenAddr: getenv("LISTEN_ADDR", ":8080"),
CKPoolSockDir: getenv("CKPOOL_SOCKDIR", "/run/ckpool"),
BitcoinRPCURL: os.Getenv("BITCOIN_RPC_URL"),
BitcoinRPCUser: os.Getenv("BITCOIN_RPC_USER"),
ListenAddr: getenv("LISTEN_ADDR", ":8080"),
CKPoolSockDir: getenv("CKPOOL_SOCKDIR", "/run/ckpool"),
BitcoinRPCURL: os.Getenv("BITCOIN_RPC_URL"),
BitcoinRPCUser: os.Getenv("BITCOIN_RPC_USER"),
BitcoinRPCPassword: os.Getenv("BITCOIN_RPC_PASSWORD"),
BitcoinRPCTimeout: getenvDuration("BITCOIN_RPC_TIMEOUT", 10*time.Second),
BitcoinZMQBlock: os.Getenv("BITCOIN_ZMQ_BLOCK"),
CKPoolLogFile: getenv("CKPOOL_LOGFILE", "/var/log/ckpool/ckpool.log"),
DBPath: getenv("DB_PATH", "/var/lib/kamado/kamado.db"),
PollInterval: getenvDuration("POLL_INTERVAL", 5*time.Second),
MempoolBaseURL: os.Getenv("MEMPOOL_BASE_URL"),
BitcoinRPCTimeout: getenvDuration("BITCOIN_RPC_TIMEOUT", 10*time.Second),
BitcoinZMQBlock: os.Getenv("BITCOIN_ZMQ_BLOCK"),
CKPoolLogFile: getenv("CKPOOL_LOGFILE", "/var/log/ckpool/ckpool.log"),
DBPath: getenv("DB_PATH", "/var/lib/kamado/kamado.db"),
PollInterval: getenvDuration("POLL_INTERVAL", 5*time.Second),
MempoolBaseURL: os.Getenv("MEMPOOL_BASE_URL"),
StratumServersJSON: os.Getenv("STRATUM_SERVERS"),
}
if cfg.BitcoinRPCURL == "" {