config

package
v1.7.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 16, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	AppName          string `mapstructure:"-"`
	ConfigFileName   string `mapstructure:"-"`
	CustomConfigPath string `mapstructure:"-"`

	// FIX #1: Exported types so other packages can declare variables of these types
	NotifierServerData *NotifierServerData  `mapstructure:"notifier_server"`
	SubscriptionsData  []*SubscriptionsData `mapstructure:"subscriptions"`
	// contains filtered or unexported fields
}

func (*Config) GetAllSubscriptionArns added in v1.7.5

func (c *Config) GetAllSubscriptionArns() []SubscriptionsData

FIX #3: GetSubscriptionArn — added nil receiver check and nil element check to prevent panic on bare Config{} or if SubscriptionsData contains nil entries. GetAllSubscriptionArns returns a snapshot of all subscription data under the lock.

func (*Config) GetSubscriptionArn

func (c *Config) GetSubscriptionArn(topicArn string) string

func (*Config) Read

func (c *Config) Read() error

Read will load config settings from disk. FIX #7: Builds into local variables first and only overwrites c._v, c.NotifierServerData, and c.SubscriptionsData on success, so a failed Read() doesn't destroy previously valid state.

func (*Config) RemoveSubscriptionData

func (c *Config) RemoveSubscriptionData(topicArn string)

RemoveSubscriptionData removes subscription data from config. hint: topicArn = blank to remove all subscription data from config. FIX #5: Added nil receiver check, nil element check in loop, and uses strings.EqualFold for consistency.

func (*Config) Save

func (c *Config) Save() error

Save persists config settings to disk. FIX #8: Returns an error when _v is nil instead of silently succeeding.

func (*Config) SetDynamoDBActionRetries

func (c *Config) SetDynamoDBActionRetries(i uint) error

func (*Config) SetDynamoDBAwsRegion

func (c *Config) SetDynamoDBAwsRegion(s string) error

func (*Config) SetDynamoDBDaxUrl

func (c *Config) SetDynamoDBDaxUrl(s string) error

func (*Config) SetDynamoDBTable

func (c *Config) SetDynamoDBTable(s string) error

func (*Config) SetDynamoDBTimeoutSeconds

func (c *Config) SetDynamoDBTimeoutSeconds(i uint) error

func (*Config) SetDynamoDBUseDax

func (c *Config) SetDynamoDBUseDax(b bool) error

func (*Config) SetNotifierGatewayUrl

func (c *Config) SetNotifierGatewayUrl(s string) error

func (*Config) SetServerKey

func (c *Config) SetServerKey(s string) error

func (*Config) SetSnsAwsRegion

func (c *Config) SetSnsAwsRegion(s string) error

func (*Config) SetSubscriptionData

func (c *Config) SetSubscriptionData(topicArn string, subscriptionArn string)

FIX #4: SetSubscriptionData — added nil receiver check, nil element check in loop, and ensureServerData guard. Uses strings.EqualFold for consistency.

type NotifierServerData added in v1.7.1

type NotifierServerData struct {
	GatewayUrl             string `mapstructure:"gateway_url"`
	ServerKey              string `mapstructure:"server_key"`
	DynamoDBAwsRegion      string `mapstructure:"dynamodb_aws_region"`
	DynamoDBUseDax         bool   `mapstructure:"dynamodb_use_dax"`
	DynamoDBDaxUrl         string `mapstructure:"dynamodb_dax_url"`
	DynamoDBTable          string `mapstructure:"dynamodb_table"`
	DynamoDBTimeoutSeconds uint   `mapstructure:"dynamodb_timeout_seconds"`
	DynamoDBActionRetries  uint   `mapstructure:"dynamodb_action_retries"`
	SnsAwsRegion           string `mapstructure:"sns_aws_region"`
}

FIX #1: Exported so other packages can reference this type directly

type SubscriptionsData added in v1.7.1

type SubscriptionsData struct {
	TopicArn        string `mapstructure:"topic_arn"`
	SubscriptionArn string `mapstructure:"subscription_arn"`
}

FIX #1: Exported so other packages can reference this type directly

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL