dga

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2024 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) (envFile *os.File, err 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. https://docs.gitlab.com/ee/ci/variables/#enable-debug-logging
	IsDebug bool `env:"CI_DEBUG_TRACE"` // IsDebug is based on gitlab flagging as debug/trace level.

	CIProjectDirectory string `env:"CI_PROJECT_DIR,notEmpty"` // CIProjectDirectory is populated by CI_PROJECT_DIR which provides the fully qualified path to the project. https://docs.gitlab.com/ee/ci/variables/
	CIJobName          string `env:"CI_JOB_NAME,notEmpty"`    // CIJobName is populated by CI_JOB_NAME which provides the fully qualified path to the project. https://docs.gitlab.com/ee/ci/variables/

	DomainEnv       string `env:"DSV_DOMAIN,notEmpty"`                 // Tenant domain name (e.g. example.secretsvaultcloud.com).
	ClientIDEnv     string `env:"DSV_CLIENT_ID,notEmpty"`              // Client ID for authentication.
	ClientSecretEnv string `json:"-" env:"DSV_CLIENT_SECRET,notEmpty"` // Client Secret for authentication.
	RetrieveEnv     string `env:"DSV_RETRIEVE,notEmpty"`               // 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"`
}

SecretToRetrieve defines JSON format of elements that expected in DSV_RETRIEVE list.

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