config

package
v0.0.0-...-e1dc571 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrConfigFileNotFound = errors.New("Config file not found")
)

Functions

func Load

func Load(cfg *Config, path string) (err error)

Load parse both the environment and the configuration file if any, to fill the configuration structure of the server.

Types

type Config

type Config struct {
	// The name of the program.
	Name string
	// The version of the program.
	Version string `mapstructure:"version"`
	// The session ID of the program.
	SessionID string
	// The number of worker that will fetch and push images to the S3 Bucket.
	NbWorker uint64 `mapstructure:"nb_worker"`
	// The lowest log type that should display the server, info by default.
	LogLevel string `mapstructure:"log_level"`
	// The configuration for the request to the Google API.
	GoogleAPI GoogleAPIConfig `mapstructure:"google_api"`
	// The configuration of the connection to the Redis server.
	Redis RedisConfig `mapstructure:"redis"`
	// The configuration of the S3 Bucket connection.
	S3 S3Config `mapstructure:"s3"`
}

type GoogleAPIConfig

type GoogleAPIConfig struct {
	// The API key needed to enable request to the Google API.
	Key string `mapstructure:"key" validate:"required"`
	// The configuration of the picture to request to the Google API.
	Picture PictureConfig `mapstructure:"picture"`
}

A configuration for the request send to the Google API.

type PictureConfig

type PictureConfig struct {
	// The zoom value of the picture.
	Zoom uint64 `mapstructure:"zoom"`
	// The width of the picture.
	Width uint64 `mapstructure:"width"`
	// The height of the picture.
	Height uint64 `mapstructure:"height"`
	// The id of the Google API map type.
	MapType string `mapstructure:"map_type"`
	// The image format (jpg, png or gif).
	Format string `mapstructure:"format"`
}

type RedisConfig

type RedisConfig struct {
	// The address of the Redis server.
	Addr string `mapstructure:"addr"`
	// The password of the Redis server.
	Password string `mapstructure:"password"`
	// The database of the Redis server to connect with.
	DB int `mapstructure:"db"`
	// The name of the queue to pop element from in the Redis server.
	QueueName string `mapstructure:"queue_name"`
}

A configuration for a connection to a Redis Server.

type S3Config

type S3Config struct {
	// The address of the S3 Bucket endpoint.
	Endpoint string `mapstructure:"enpoint"`
	// The region of the S3 Bucket.
	Region string
	// The name of the S3 Bucket.
	BucketName string `mapstructure:"bucket_name"`
	// The folder where satellite image will be pushed.
	ImageFolder string `mapstructure:"image_folder"`
	// The Access Key ID of the S3 Bucket.
	AccessKeyID string `mapstructure:"access_key_id" validate:"required"`
	// Access Key Secret of the S3 Bucket.
	AccessKeySecret string `mapstructure:"access_key_secret" validate:"required"`
}

A configuration for a connection to a S3 Bucket

Jump to

Keyboard shortcuts

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