Documentation ¶
Overview ¶
Package settings is a package that implements Dependency Injection through methods that create the options needed for structs to be created. See GetSettings for more information.
This package uses anonymous structs as the injection options, this is to avoid issues with import loops when importing settings into *_test.go files.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Settings ¶
type Settings struct { DBDriver string DBDsn string Home string // No Colour output when running commands. NoColour bool // Project name, normally supplied by the start sub command. ProjectName string PathMetadataDir string PathTemplateConf string PathTemplateDir string PathUserConf string SqliteDB string Stdin io.Reader Stderr io.Writer Stdout io.Writer // contains filtered or unexported fields }
Settings provides settings for resources & services.
func GetSettings ¶
GetSettings get settings using the supplied "home" directory option. Any Dependency Injection (DI) configuration created by settings is then contextualized by the home variable. For instance when home is set the paths...
{{home}}/.prjstart/config.yml {{home}}/.prjstart/templates.yml {{home}}/.prjstart/metadata/metadata.db {{home}}/.prjstart/templates etc..
are then factored in when creating dependency injections.
If initialization is needed for testing then the initialize package can be used. For example
set := GetSettings("/tmp/tmp_home"); init := initialize.New(iinitialize.Inject(s)); init.Init()
will create the structures under "/tmp/tmp_home"
"home" must be explicitly set or a panic will ensue.
func (*Settings) ConfigFile ¶
ConfigFile load settings from configuration file