config

package
v0.0.0-...-32b810b Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigureLogging

func ConfigureLogging(cfg *Configuration)

Types

type Configuration

type Configuration struct {
	Profiles []string `ignored:"true"`
	Server   ServerConfiguration
	Database DatabaseConfiguration
	Security SecurityConfiguration
	Storage  StorageConfiguration
	Index    IndexConfiguration
}

Configuration holds all the whole application's configuration.

func Load

func Load(production bool) *Configuration

Load loads the application configuration.

func (Configuration) HasProfile

func (c Configuration) HasProfile(profile string) bool

HasProfile returns a boolean value indicating whether the given profile is active.

func (Configuration) IsProductionMode

func (c Configuration) IsProductionMode() bool

IsProductionMode returns a boolean value indicating whether the applications runs in production mode (having active profile 'production').

type DatabaseConfiguration

type DatabaseConfiguration struct {
	Type            string `default:"sqlite3"`
	URL             string `default:"database.db"`
	MigrateDatabase bool   `default:"true"`
}

DatabaseConfiguration holds all configuration values regarding the database.

type IndexConfiguration

type IndexConfiguration struct {
	DocumentsPath string `default:"documents.bleve" split_words:"true"`
}

type SecurityConfiguration

type SecurityConfiguration struct {
	JWTAlgorithm      string        `default:"HS256" split_words:"true"`
	JWTSecret         []byte        `split_words:"true"`
	JWTExpirationTime time.Duration `default:"5m" split_words:"true"`
	JWTRefreshTime    time.Duration `default:"24h" split_words:"true"`
}

SecurityConfiguration holds all configuration values regarding security.

type ServerConfiguration

type ServerConfiguration struct {
	PublicURL string `default:"http://localhost:8080"`
	Port      int    `default:"8080"`
}

ServerConfiguration holds all configuration values regarding the HTTP server.

type StorageConfiguration

type StorageConfiguration struct {
	DataPath string `default:"data" split_words:"true"`
}

StorageConfiguration holds all configuration values regarding file storage.

Jump to

Keyboard shortcuts

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