Standardize codebase consistency: naming, JSON tags, logging, error wrapping
- JSON tags: fix snake_case to camelCase in dnsmasq (configFile, domainsConfigured, lastRestart), crowdsec Machine (lastPush, lastHeartbeat), network (primaryIP, primaryInterface). cscli raw parsing structs keep snake_case to match CLI output. - Error wrapping: fix %v to %w in enableAuthelia for proper error chain preservation - Naming: rename dnsmasq.ConfigGenerator to dnsmasq.Manager (matches all other packages), rename ServiceStatus to Status in dnsmasq and haproxy (matches authelia, crowdsec, etc.) - Logging: standardize all slog calls to use "component" key instead of message prefixes. Affects reconcile, dnsfilter, ddns — now consistent with dnsmasq, haproxy, nftables, sse.
This commit is contained in:
@@ -150,26 +150,26 @@ func (api *API) enableAuthelia(state *config.State) error {
|
||||
}
|
||||
|
||||
if err := api.authelia.EnsureDataDir(); err != nil {
|
||||
return fmt.Errorf("Failed to create data directory: %v", err)
|
||||
return fmt.Errorf("failed to create data directory: %w", err)
|
||||
}
|
||||
if err := api.ensureAutheliaSecrets(); err != nil {
|
||||
return fmt.Errorf("Failed to generate secrets: %v", err)
|
||||
return fmt.Errorf("failed to generate secrets: %w", err)
|
||||
}
|
||||
if err := api.authelia.EnsureJWKS(); err != nil {
|
||||
return fmt.Errorf("Failed to generate JWKS: %v", err)
|
||||
return fmt.Errorf("failed to generate JWKS: %w", err)
|
||||
}
|
||||
if err := api.authelia.EnsureUsersDB(); err != nil {
|
||||
return fmt.Errorf("Failed to initialize user database: %v", err)
|
||||
return fmt.Errorf("failed to initialize user database: %w", err)
|
||||
}
|
||||
if err := api.generateAutheliaConfig(state); err != nil {
|
||||
return fmt.Errorf("Failed to generate config: %v", err)
|
||||
return fmt.Errorf("failed to generate config: %w", err)
|
||||
}
|
||||
|
||||
api.ensureAuthDomain(state.Cloud.Authelia.Domain)
|
||||
|
||||
if api.authelia.UserCount() > 0 {
|
||||
if err := api.authelia.RestartService(); err != nil {
|
||||
return fmt.Errorf("Configuration saved but Authelia failed to start: %v", err)
|
||||
return fmt.Errorf("authelia failed to start: %w", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user