config

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2018 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ConfigFileName is the name of the config files (home / project)
	ConfigFileName = "config"
	// ConfigFileType is the config file extension
	ConfigFileType = "yaml"
	// ConfigFileNameWithExt is the config filename with extension
	ConfigFileNameWithExt = fmt.Sprintf("%s.%s", ConfigFileName, ConfigFileType)
	// ConfigDir is the directory for astro files
	ConfigDir = ".astro"

	// HomeConfigPath is the path to the users global directory
	HomeConfigPath = filepath.Join(fileutil.GetHomeDir(), ConfigDir)
	// HomeConfigFile is the global config file
	HomeConfigFile = filepath.Join(HomeConfigPath, ConfigFileNameWithExt)

	// CFGStrMap maintains string to cfg mapping
	CFGStrMap = make(map[string]cfg)

	// CFG Houses configuration meta
	CFG = cfgs{
		CloudDomain:      newCfg("cloud.domain", true, ""),
		CloudAPIProtocol: newCfg("cloud.api.protocol", true, "https"),
		CloudAPIPort:     newCfg("cloud.api.port", true, "443"),
		CloudAPIToken:    newCfg("cloud.api.token", true, ""),
		LocalAPIURL:      newCfg("local.api.url", true, ""),
		PostgresUser:     newCfg("postgres.user", true, "postgres"),
		PostgresPassword: newCfg("postgres.password", true, "postgres"),
		PostgresHost:     newCfg("postgres.host", true, "postgres"),
		PostgresPort:     newCfg("postgres.port", true, "5432"),
		ProjectName:      newCfg("project.name", true, ""),
		ProjectWorkspace: newCfg("project.workspace", true, ""),
	}
)

Functions

func APIUrl added in v0.2.0

func APIUrl() string

APIUrl will return a full qualified API url

func CreateConfig

func CreateConfig(v *viper.Viper, path, file string) error

CreateConfig creates a config file in the given directory

func CreateProjectConfig

func CreateProjectConfig(projectPath string)

CreateProjectConfig creates a project config file

func InitConfig

func InitConfig()

InitConfig initializes the config files

func ProjectConfigExists

func ProjectConfigExists() bool

ProjectConfigExists returns a boolean indicating if a project config file exists

func ProjectRoot

func ProjectRoot() (string, error)

ProjectRoot returns the path to the nearest project root

Types

This section is empty.

Jump to

Keyboard shortcuts

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