cmd

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2022 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

Types

type TwelveFactorConnections

type TwelveFactorConnections struct{} // implements interfaces in module, actions.

func (*TwelveFactorConnections) GetConnectionDetails

func (t *TwelveFactorConnections) GetConnectionDetails(connectionName string) (*shared.ConnectionDetails, error)

GetConnectionDetails expects outConnectionDetails to be a pointer to a connection-specific struct, which it fills with connection details fetched from env variables by using the connectionName to do the lookup, where the connectionName is either source or target. The connection type is picked up from the environment using variable whose name matches constant envVarSourceType and envVarTargetType respectively. If the type of outConnectionDetails does not match the type found inside the connection then an error is produced, otherwise the config keys and values are put into outConnectionDetails. TODO: add tests for GetConnectionDetails

func (*TwelveFactorConnections) GetConnectionType

func (t *TwelveFactorConnections) GetConnectionType(connectionName string) (connectionType string, err error)

GetConnectionType is for use when running in twelveFactorMode. It returns the value of envVarSourceType or envVarTargetType based on the supplied connectionName,

where connectionName is expected to bee either defaultConnectionNameSource or defaultConnectionNameTarget.

It reads the global map twelveFactorVars[] which should have been setup using environment variables.

func (*TwelveFactorConnections) LoadConnection

func (t *TwelveFactorConnections) LoadConnection(connectionName string) (shared.ConnectionDetails, error)

Load connection DSN from the environment, parse it based on type set in the environment and return the shared.ConnectionDetails. This mimics functionality whereby connection details are loaded from JSON config file, but reads info from the environment instead. This is used by the pipe action since the full connection details may not be saved out to the pipe config file. TODO: add test for LoadConnection

Jump to

Keyboard shortcuts

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