dga

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2022 License: MIT Imports: 13 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 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 ExportEnvVariable

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

func OpenEnvFile

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

OpenEnvFile storing secrets that can extend to another job or task in Gitlab. See [GitLab - Passing An Environment Variable to Another Job](https://docs.gitlab.com/ee/ci/variables/#pass-an-environment-variable-to-another-job)

func Run

func Run() error

Types

type Config

type Config struct {
	IsCI    bool `env:"GITLAB_CI"` // IsCI determines if the system is detecting being in CI system.
	IsDebug bool `env:"DEBUG"`     // IsDebug is based on gitlab 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"`
}

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