Skip to content

Commit 3aa618e

Browse files
committed
This fixes issue #23 -- thank you @int2001
1 parent 0689c83 commit 3aa618e

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

config/config.go

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,15 @@ const (
2222
DefaultDataDir = "/data" // Inside the container
2323

2424
// Hard-coded Club Log API details (per-application, not per-user)
25-
// These values are based on the original Node.js project's use.
26-
ClubLogAPIKey = "608df94896cb9c5421ae748235492b43815610c9"
25+
// If you need to change this, please contact the ClubLog Helpdesk for a new API key.
26+
// See: https://clublog.freshdesk.com/support/solutions/articles/54910-api-keys
27+
ClubLogAPIKey = "6c57da3a4712d42091bd39409cbac82d30044a61"
2728
)
2829

2930
var (
3031
// These are baked-in, not user-configurable. Keep them package-level so they can be
3132
// changed by developers in code if necessary.
32-
ClubLogAPIURL = "https://cdn.clublog.org/cty.php?api=608df94896cb9c5421ae748235492b43815610c9"
33+
ClubLogAPIURL = fmt.Sprintf("https://cdn.clublog.org/cty.php?api=%s", ClubLogAPIKey)
3334
FallbackGitHubURL = "https://github.com/wavelog/dxcc_data/raw/refs/heads/master/cty.xml.gz"
3435

3536
// Default LoTW URL - can be overridden via environment variable
@@ -115,21 +116,26 @@ type Config struct {
115116
LoTWUpdateInterval time.Duration `env:"LOTW_UPDATE_INTERVAL" envDefault:"168h"` // Weekly
116117

117118
Redis RedisConfig
119+
118120
// ClubLog API key (allows overriding via env)
119-
ClubLogAPIKey string `env:"CLUBLOG_API_KEY" envDefault:"608df94896cb9c5421ae748235492b43815610c9"`
121+
ClubLogAPIKey string `env:"CLUBLOG_API_KEY"`
122+
120123
// Optional (test) overrides for DXCC source URLs. These are usually the package-level
121124
// defaults in production, but tests create Config literals expecting to override them.
122125
ClubLogAPIURL string
123126
FallbackGitHubURL string
127+
124128
// Default channel buffer for DX cluster clients (overridable per-cluster config)
125129
DXCChannelBuffer int `env:"DXC_CHANNEL_BUFFER" envDefault:"32"`
126130

127131
// Proxy Configuration for X-Forwarded-For header handling
128132
// TRUSTED_PROXIES: comma-separated list of trusted proxy IPs or CIDR ranges (e.g., "192.168.1.0/24,10.0.0.5")
129133
// If not set, X-Forwarded-For header is ignored
130134
TrustedProxies string `env:"TRUSTED_PROXIES" envDefault:""`
135+
131136
// REMOTE_IP_HEADER: the header name to use for remote IP extraction (default: X-Forwarded-For)
132137
RemoteIPHeader string `env:"REMOTE_IP_HEADER" envDefault:"X-Forwarded-For"`
138+
133139
// REMOTE_IP_INVERT: if false (default), picks the LAST IP in the header; if true, picks the FIRST IP
134140
RemoteIPInvert bool `env:"REMOTE_IP_INVERT" envDefault:"false"`
135141
}
@@ -146,6 +152,11 @@ func LoadConfig() (*Config, error) {
146152
return nil, fmt.Errorf("failed to parse Redis environment variables: %w", err)
147153
}
148154

155+
// Set ClubLog API key default if not provided via environment
156+
if cfg.ClubLogAPIKey == "" {
157+
cfg.ClubLogAPIKey = ClubLogAPIKey
158+
}
159+
149160
// --- DX Cluster Configuration Logic ---
150161
// Only use CLUSTERS JSON - no more legacy support
151162
if cfg.RawClustersJSON != "" {

0 commit comments

Comments
 (0)