dga

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const PermissionReadWriteOwner = 0o600

PermissionReadWriteOwner is the octal permission for Read Write for the owner of the file.

Variables

This section is empty.

Functions

func ActionsExportVariable

func ActionsExportVariable(envFile *os.File, key, val string) error

func ActionsOpenEnvFile

func ActionsOpenEnvFile(cfg *Config) (*os.File, error)

ActionsOpenEnvFile is used for writing secrets back in GitHub.

func DSVGetSecret

func DSVGetSecret(client HTTPClient, apiEndpoint, accessToken string, item SecretToRetrieve, cfg *Config) (map[string]interface{}, error)

func DSVGetToken

func DSVGetToken(c HTTPClient, apiEndpoint string, cfg *Config) (string, error)

func Run

func Run() error

Types

type Config

type Config struct {
	IsCI    bool `env:"GITHUB_ACTIONS"` // IsCI determines if the system is detecting being in CI system.
	IsDebug bool `env:"RUNNER_DEBUG"`   // IsDebug is based on github action flagging as debug/trace level.

	SetEnv          bool   `env:"DSV_SET_ENV"`                         // SetEnv is only for GitHub Actions.
	DomainEnv       string `env:"DSV_DOMAIN,required"`                 // Tenant domain name (e.g. example.secretsvaultcloud.com).
	ClientIDEnv     string `env:"DSV_CLIENT_ID,required"`              // Client ID for authentication.
	ClientSecretEnv string `json:"-" env:"DSV_CLIENT_SECRET,required"` // Client Secret for authentication.
	RetrieveEnv     string `env:"DSV_RETRIEVE,required"`               // JSON formatted string with data to retrieve from DSV.
}

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

type SecretToRetrieve

type SecretToRetrieve struct {
	SecretPath     string `json:"secretPath"`
	SecretKey      string `json:"secretKey"`
	OutputVariable string `json:"outputVariable"`
}

RetrieveValues is the struct to put keyvalues into

type RetrieveValues struct {
	SecretToRetrieve []SingleValue
}

func ParseRetrieve

func ParseRetrieve(retrieve string) ([]SecretToRetrieve, error)

Jump to

Keyboard shortcuts

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