Documentation
¶
Index ¶
- func AddKindToNIPMapping(kind int, nip int) error
- func GenerateRandomAPIKey() (string, error)
- func GetAllSettingsAsMap() (map[string]interface{}, error)
- func GetAllowedUsersSettings() (*types.AllowedUsersSettings, error)
- func GetConfig() (*types.Config, error)
- func GetDataDir() string
- func GetExternalURL(service string) string
- func GetNIPForKind(kind int) (int, error)
- func GetNIPMappings() map[string]string
- func GetPath(subPath string) string
- func GetPort(service string) int
- func GetSettingValue(key string) (interface{}, error)
- func GetSupportedNIPsFromKinds(kinds []string) ([]int, error)
- func InitConfig() error
- func InitConfigForTesting()
- func IsEnabled(feature string) bool
- func RefreshConfig() error
- func RemoveNIPMapping(kind string) error
- func SaveConfig() error
- func UpdateConfig(key string, value interface{}, save bool) error
- func UpdateMultipleSections(settings map[string]interface{}) error
- func UpdateNIPMapping(kind, nip string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddKindToNIPMapping ¶
AddKindToNIPMapping adds or updates a kind-to-NIP mapping
func GenerateRandomAPIKey ¶
GenerateRandomAPIKey generates a random 32-byte hexadecimal key
func GetAllSettingsAsMap ¶
GetAllSettingsAsMap returns all configuration settings as a map This is a thread-safe alternative to viper.AllSettings() which can cause concurrent map read/write errors when viper.WatchConfig() is enabled
func GetAllowedUsersSettings ¶
func GetAllowedUsersSettings() (*types.AllowedUsersSettings, error)
GetAllowedUsersSettings returns the allowed users settings from cached config
func GetConfig ¶
GetConfig returns the cached configuration struct This is extremely fast as it only reads from atomic.Value
func GetExternalURL ¶
GetExternalURL returns external service URLs
func GetNIPForKind ¶
GetNIPForKind returns the NIP number for a given kind
func GetNIPMappings ¶
GetNIPMappings returns the current NIP mappings from configuration
func GetPort ¶
GetPort returns the port for a service from configuration Falls back to base port with offset calculation if service-specific port not configured
func GetSettingValue ¶
GetSettingValue returns a specific setting value by key path (e.g., "relay.name") This is a thread-safe alternative to viper.Get()
func GetSupportedNIPsFromKinds ¶
GetSupportedNIPsFromKinds returns unique NIP numbers for given kinds
func InitConfigForTesting ¶
func InitConfigForTesting()
InitConfigForTesting initializes the configuration system for testing This should be called after setting up viper values manually in tests It loads the config into the cache without reading from a file
func RefreshConfig ¶
func RefreshConfig() error
RefreshConfig forces a reload of the configuration cache This should be called after external changes to the configuration (e.g., via web UI)
func RemoveNIPMapping ¶
RemoveNIPMapping removes a NIP mapping for a specific kind
func UpdateConfig ¶
UpdateConfig updates a configuration value and optionally saves it Now with change detection to avoid unnecessary writes
func UpdateMultipleSections ¶
UpdateMultipleSections updates multiple configuration sections intelligently Only saves once at the end, and only if there were changes
func UpdateNIPMapping ¶
UpdateNIPMapping updates or adds a single NIP mapping
Types ¶
This section is empty.