config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2022 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package config create AWS session and distribute it (alongside other config value) to any package interested.

Index

Constants

View Source
const (
	AwsRegion                   = "aws.region"
	AwsKey                      = "aws.key"
	AwsSecret                   = "aws.secret"
	ArchiveDynamodbTable        = "archive.dynamodb.table"
	ArchiveMainBucketName       = "archive.main.bucketName"
	ArchiveCacheBucketName      = "archive.cache.bucketName"
	ArchiveJobsSNSARN           = "archive.sns.arn"
	ArchiveJobsSQSURL           = "archive.sqs.url"
	BackupConcurrencyAnalyser   = "backup.concurrency.analyser"
	BackupConcurrencyCataloguer = "backup.concurrency.cataloguer"
	BackupConcurrencyUploader   = "backup.concurrency.uploader"
	CatalogDynamodbTable        = "catalog.dynamodb.table"
	LocalHome                   = "home.dir"
	Owner                       = "owner"
)

Variables

View Source
var (
	ForcedConfigFile string // ForcedConfigFile is the path to the file of the config to use (instead of defaulting to ./dphoto.yml, $HOME/.dphoto/dphoto.yml, ...)
	Environment      string // Environment is used as suffix for the config file name.

)

Functions

func Connect

func Connect(ignite, createConfigIfNotExist bool) error

Connect must be called by main function, it dispatches the config to all components requiring it. Set ignite to TRUE to connect to AWS (required for most commands)

func Listen

func Listen(listener Listener)

Listen registers a Listener that will be invoked when configuration will be provided.

Types

type Config

type Config interface {
	Get(key string) interface{}
	GetString(key string) string
	GetStringOrDefault(key string, defaultValue string) string
	GetBool(key string) bool
	GetInt(key string) int
	GetIntOrDefault(key string, defaultValue int) int
	GetAWSSession() *session.Session
}

type Listener

type Listener func(Config)

Listener function is called once config is loaded

Jump to

Keyboard shortcuts

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