Documentation ¶
Overview ¶
Package env is used to load environment variables in the context of using the core-mage targets and development environment. It provides convenient functions for loading or overloading.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var ( // DevFiles represents the development files to be loaded in order. DevFiles = []string{ "infra/personal.env", "infra/local.dev.env", "infra/common.env", ".env", } // TestFiles represents the test files to be loaded in order. TestFiles = []string{ "infra/local.test.env", "infra/common.env", } )
var (
// DefaultMigrationsPath is the default path to migrations relative from the project root.
DefaultMigrationsPath = "service/database/migrations"
)
Functions ¶
func Load ¶ added in v0.9.0
func Load(paths ...string)
Load tries to load given env files, leaving current environment variables intact.
Example ¶
package main import ( "github.com/LUSHDigital/core-mage/env" ) func main() { env.Load("infa/does-not-override.env") }
Output:
func LoadDefault ¶ added in v0.9.0
func LoadDefault()
LoadDefault will attempt to load the default environment.
func LoadTest ¶ added in v0.9.0
LoadTest tries to load given env files, leaving current environment variables intact.
Example ¶
package main import ( "testing" "github.com/LUSHDigital/core-mage/env" ) var m *testing.M func main() { env.LoadTest(m, "infa/does-not-override.env") }
Output:
func MigrationsTestURL ¶ added in v0.9.4
MigrationsTestURL returns the migrations path relative to the project root.
func MustLoadDefaultTest ¶ added in v0.9.0
MustLoadDefaultTest will attempt to load the default test environment.
func Overload ¶ added in v0.9.0
func Overload(paths ...string)
Overload tries to overload given env files, overriding current environment variables.
Example ¶
package main import ( "github.com/LUSHDigital/core-mage/env" ) func main() { env.Overload("infa/will-override.env") }
Output:
func OverloadTest ¶ added in v0.9.0
OverloadTest tries to overload given env files, overriding current environment variables.
Example ¶
package main import ( "testing" "github.com/LUSHDigital/core-mage/env" ) var m *testing.M func main() { env.OverloadTest(m, "infa/will-override.env") }
Output:
Types ¶
This section is empty.