config

package
v0.21.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2019 License: MIT Imports: 7 Imported by: 11

Documentation

Index

Constants

View Source
const (
	// Name is the file name of the porter configuration file.
	Name = "porter.yaml"

	// EnvHOME is the name of the environment variable containing the porter home directory path.
	EnvHOME = "PORTER_HOME"

	// EnvBundleName is the name of the environment variable containing the name of the bundle.
	EnvBundleName = "CNAB_BUNDLE_NAME"

	// EnvClaimName is the name of the environment variable containing the name of the claim.
	EnvClaimName = "CNAB_INSTALLATION_NAME"

	// EnvACTION is the request
	EnvACTION = "CNAB_ACTION"

	// EnvDEBUG is a custom porter parameter that signals that --debug flag has been passed through from the client to the runtime.
	EnvDEBUG = "PORTER_DEBUG"

	CustomBundleKey = "sh.porter"

	// BundleOutputsDir is the directory where outputs are expected to be placed
	// during the execution of a bundle action.
	BundleOutputsDir = "/cnab/app/outputs"
)

Variables

This section is empty.

Functions

func NoopDataLoader

func NoopDataLoader(config *Config) error

NoopDataLoader skips loading the datastore.

Types

type Config

type Config struct {
	*context.Context
	Data       *Data
	DataLoader DataStoreLoaderFunc
	// contains filtered or unexported fields
}

func New

func New() *Config

New Config initializes a default porter configuration.

func (*Config) GetBundleArchiveLogs

func (c *Config) GetBundleArchiveLogs() (string, error)

GetArchiveLogs locates the output for Bundle Archive Operations.

func (*Config) GetBundlesCache

func (c *Config) GetBundlesCache() (string, error)

GetBundlesDir locates the bundle cache from the porter home directory.

func (*Config) GetCredentialPath

func (c *Config) GetCredentialPath(name string) (string, error)

func (*Config) GetCredentialsDir

func (c *Config) GetCredentialsDir() (string, error)

func (*Config) GetHomeDir

func (c *Config) GetHomeDir() (string, error)

GetHomeDir determines the absolute path to the porter home directory.

func (*Config) GetMixinDir

func (c *Config) GetMixinDir(mixin string) (string, error)

func (*Config) GetMixinPath

func (c *Config) GetMixinPath(mixin string) (string, error)

func (*Config) GetMixinRuntimePath

func (c *Config) GetMixinRuntimePath(mixin string) (string, error)

func (*Config) GetMixinsDir

func (c *Config) GetMixinsDir() (string, error)

func (*Config) GetPluginPath

func (c *Config) GetPluginPath(plugin string) (string, error)

func (*Config) GetPluginsDir

func (c *Config) GetPluginsDir() (string, error)

func (*Config) GetPorterPath

func (c *Config) GetPorterPath() (string, error)

func (*Config) GetPorterRuntimePath

func (c *Config) GetPorterRuntimePath() (string, error)

func (*Config) LoadData

func (c *Config) LoadData() error

LoadData from the datastore in PORTER_HOME. This defaults to doing nothing unless DataLoader has been set.

func (*Config) SetHomeDir

func (c *Config) SetHomeDir(home string)

type Data

type Data struct {
	// Only define fields here that you need to access from code
	// Values are dynamically applied to flags and don't need to be defined
	InstanceStoragePlugin string          `mapstructure:"instance-storage-plugin"`
	DefaultInstanceStore  string          `mapstructure:"default-instance-store"`
	InstanceStores        []InstanceStore `mapstructure:"instance-store"`
}

Data is the data stored in PORTER_HOME/porter.toml|yaml|json

func (*Data) GetDefaultInstanceStore

func (d *Data) GetDefaultInstanceStore() string

func (*Data) GetInstanceStoragePlugin

func (d *Data) GetInstanceStoragePlugin() string

func (*Data) GetInstanceStore

func (d *Data) GetInstanceStore(name string) (InstanceStore, error)

type DataStoreLoaderFunc

type DataStoreLoaderFunc func(*Config) error

type InstanceStore

type InstanceStore struct {
	Name         string                 `mapstructure:"name"`
	PluginSubKey string                 `mapstructure:"plugin"`
	Config       map[string]interface{} `mapstructure:"config"`
}

func (InstanceStore) GetConfig

func (is InstanceStore) GetConfig() interface{}

func (InstanceStore) GetName

func (is InstanceStore) GetName() string

func (InstanceStore) GetPluginSubKey

func (is InstanceStore) GetPluginSubKey() string

type TestConfig

type TestConfig struct {
	*Config
	TestContext *context.TestContext
}

func NewTestConfig

func NewTestConfig(t *testing.T) *TestConfig

NewTestConfig initializes a configuration suitable for testing, with the output buffered, and an in-memory file system.

func (*TestConfig) SetupIntegrationTest

func (c *TestConfig) SetupIntegrationTest(home string)

InitializePorterHome initializes the filesystem with the supporting files in the PORTER_HOME directory.

func (*TestConfig) SetupPorterHome

func (c *TestConfig) SetupPorterHome()

InitializePorterHome initializes the test filesystem with the supporting files in the PORTER_HOME directory.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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