config

package
v0.9.6 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2021 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigurationFilePath added in v0.9.6

func ConfigurationFilePath() string

func CredentialsFilePath added in v0.7.17

func CredentialsFilePath() string

func DetectProjectMetadata added in v0.9.0

func DetectProjectMetadata(ctx *ProjectContext) *schema.ProjectMetadata

func IsDev

func IsDev() bool

func IsEnvPresent added in v0.9.5

func IsEnvPresent(s string) bool

func IsTest

func IsTest() bool

func RootDir

func RootDir() string

Types

type Config

type Config struct {
	Credentials   Credentials
	Configuration Configuration

	Version         string `yaml:"version,omitempty" ignored:"true"`
	LogLevel        string `yaml:"log_level,omitempty" envconfig:"INFRACOST_LOG_LEVEL"`
	NoColor         bool   `yaml:"no_color,omitempty" envconfig:"INFRACOST_NO_COLOR"`
	SkipUpdateCheck bool   `yaml:"skip_update_check,omitempty" envconfig:"INFRACOST_SKIP_UPDATE_CHECK"`

	APIKey                    string `envconfig:"INFRACOST_API_KEY"`
	PricingAPIEndpoint        string `yaml:"pricing_api_endpoint,omitempty" envconfig:"INFRACOST_PRICING_API_ENDPOINT"`
	DefaultPricingAPIEndpoint string `yaml:"default_pricing_api_endpoint,omitempty" envconfig:"INFRACOST_DEFAULT_PRICING_API_ENDPOINT"`
	DashboardAPIEndpoint      string `yaml:"dashboard_api_endpoint,omitempty" envconfig:"INFRACOST_DASHBOARD_API_ENDPOINT"`
	EnableDashboard           bool   `yaml:"enable_dashboard,omitempty" envconfig:"INFRACOST_ENABLE_DASHBOARD"`

	Currency string `envconfig:"INFRACOST_CURRENCY"`

	Projects      []*Project `yaml:"projects" ignored:"true"`
	Format        string     `yaml:"format,omitempty" ignored:"true"`
	ShowSkipped   bool       `yaml:"show_skipped,omitempty" ignored:"true"`
	SyncUsageFile bool       `yaml:"sync_usage_file,omitempty" ignored:"true"`
	Fields        []string   `yaml:"fields,omitempty" ignored:"true"`
}

func DefaultConfig added in v0.7.17

func DefaultConfig() *Config

func (*Config) ConfigureLogger added in v0.7.17

func (c *Config) ConfigureLogger() error

func (*Config) IsLogging added in v0.7.17

func (c *Config) IsLogging() bool

func (*Config) LoadFromConfigFile added in v0.8.0

func (c *Config) LoadFromConfigFile(path string) error

func (*Config) LoadFromEnv added in v0.7.17

func (c *Config) LoadFromEnv() error

type ConfigFileSpec added in v0.8.0

type ConfigFileSpec struct {
	Version  string     `yaml:"version"`
	Projects []*Project `yaml:"projects" ignored:"true"`
}

func LoadConfigFile added in v0.8.0

func LoadConfigFile(path string) (ConfigFileSpec, error)

type Configuration added in v0.9.6

type Configuration struct {
	Version  string `yaml:"version"`
	Currency string `yaml:"currency,omitempty"`
}

func (Configuration) Save added in v0.9.6

func (c Configuration) Save() error

type Credentials added in v0.7.17

type Credentials struct {
	Version            string `yaml:"version"`
	APIKey             string `yaml:"api_key,omitempty"`
	PricingAPIEndpoint string `yaml:"pricing_api_endpoint,omitempty"`
}

func (Credentials) Save added in v0.7.17

func (c Credentials) Save() error

type Project added in v0.8.0

type Project struct {
	Path                string `yaml:"path,omitempty" ignored:"true"`
	TerraformPlanFlags  string `yaml:"terraform_plan_flags,omitempty" ignored:"true"`
	TerraformBinary     string `yaml:"terraform_binary,omitempty" envconfig:"INFRACOST_TERRAFORM_BINARY"`
	TerraformWorkspace  string `yaml:"terraform_workspace,omitempty" envconfig:"INFRACOST_TERRAFORM_WORKSPACE"`
	TerraformCloudHost  string `yaml:"terraform_cloud_host,omitempty" envconfig:"INFRACOST_TERRAFORM_CLOUD_HOST"`
	TerraformCloudToken string `yaml:"terraform_cloud_token,omitempty" envconfig:"INFRACOST_TERRAFORM_CLOUD_TOKEN"`
	UsageFile           string `yaml:"usage_file,omitempty" ignored:"true"`
	TerraformUseState   bool   `yaml:"terraform_use_state,omitempty" ignored:"true"`
}

type ProjectContext added in v0.9.3

type ProjectContext struct {
	RunContext    *RunContext
	ProjectConfig *Project
	// contains filtered or unexported fields
}

func EmptyProjectContext added in v0.9.3

func EmptyProjectContext() *ProjectContext

func NewProjectContext added in v0.9.3

func NewProjectContext(runCtx *RunContext, projectCfg *Project) *ProjectContext

func (*ProjectContext) ContextValues added in v0.9.3

func (c *ProjectContext) ContextValues() map[string]interface{}

func (*ProjectContext) SetContextValue added in v0.9.3

func (c *ProjectContext) SetContextValue(key string, value interface{})

type RunContext added in v0.9.3

type RunContext struct {
	Config *Config
	State  *State
	// contains filtered or unexported fields
}

func EmptyRunContext added in v0.9.3

func EmptyRunContext() *RunContext

func NewRunContextFromEnv added in v0.9.3

func NewRunContextFromEnv(rootCtx context.Context) (*RunContext, error)

func (*RunContext) ContextValues added in v0.9.3

func (c *RunContext) ContextValues() map[string]interface{}

func (*RunContext) ContextValuesWithCurrentProject added in v0.9.3

func (c *RunContext) ContextValuesWithCurrentProject() map[string]interface{}

func (*RunContext) EventEnv added in v0.9.3

func (c *RunContext) EventEnv() map[string]interface{}

func (*RunContext) EventEnvWithProjectContexts added in v0.9.3

func (c *RunContext) EventEnvWithProjectContexts(projectContexts []*ProjectContext) map[string]interface{}

func (*RunContext) SetContextValue added in v0.9.3

func (c *RunContext) SetContextValue(key string, value interface{})

func (*RunContext) SetCurrentProjectContext added in v0.9.3

func (c *RunContext) SetCurrentProjectContext(ctx *ProjectContext)

type State added in v0.7.17

type State struct {
	InstallID              string `json:"installId"`
	LatestReleaseVersion   string `json:"latestReleaseVersion"`
	LatestReleaseCheckedAt string `json:"latestReleaseCheckedAt"`
}

func LoadState added in v0.9.3

func LoadState() (*State, error)

func (*State) Save added in v0.7.17

func (s *State) Save() error

Jump to

Keyboard shortcuts

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