env

package
v0.12.5 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetEnvName

func GetEnvName(env string) (string, error)

func GetEnvNameFromFile

func GetEnvNameFromFile(fileName string) (string, error)

func GetEnvironmentID

func GetEnvironmentID() (string, error)

func GetEnvsInDirectory

func GetEnvsInDirectory() ([]string, error)

func GetFileName

func GetFileName(env string) (string, error)

func GetLocalEnvContents

func GetLocalEnvContents(envName string) (string, error)

func HashData

func HashData(data string) string

HashData returns the SHA256 hash of the environment data.

func IsEnvVar

func IsEnvVar(line string) bool

Types

type Env

type Env struct {
	Size           string              `json:"size"`
	CountVariables int                 `json:"countVariables"`
	Data           string              `json:"data"`
	ID             *string             `json:"id,omitempty"`
	Version        *int                `json:"version,omitempty"`
	ProjectEnv     *ProjectEnvironment `json:"projectEnvironment,omitempty"`
	SecretKeyId    *int64              `json:"secretKeyId,omitempty"`
	Published      *time.Time          `json:"published,omitempty"`
}

func GetLocalEncryptedEnv

func GetLocalEncryptedEnv(envName string, m manifest.Manifest) (Env, error)

func New

func New(fileName string) (Env, error)

func NewWithEncryptedData

func NewWithEncryptedData(fileName string, key secretkey.SecretKeyer) (Env, error)

func (*Env) DecryptData

func (e *Env) DecryptData(key secretkey.SecretKeyer) (string, error)

func (*Env) DecryptVarsAndSaveIntoFile

func (e *Env) DecryptVarsAndSaveIntoFile(fileName string, key secretkey.SecretKeyer) (string, error)

func (*Env) EncryptData

func (e *Env) EncryptData(key secretkey.SecretKeyer) (string, error)

func (*Env) HashData

func (e *Env) HashData() string

type EnvService

type EnvService struct {
	// contains filtered or unexported fields
}

func NewService

func NewService() *EnvService

func (*EnvService) GetEnvironment

func (es *EnvService) GetEnvironment(organizationId, projectId, environmentId string) (Environment, bool, error)

func (*EnvService) GetEnvironmentEnv

func (es *EnvService) GetEnvironmentEnv(organizationId, appId, environmentId string, secretKeyId *int64, version *int) (Env, error)

func (*EnvService) ListEnvVersions

func (es *EnvService) ListEnvVersions(organizationId, appId, environmentId string, size, page int) ([]Env, error)

func (*EnvService) ListEnvironments

func (es *EnvService) ListEnvironments(organizationId, projectId string, size, page int) ([]Environment, error)

func (*EnvService) ListEnvs

func (es *EnvService) ListEnvs(organizationId, appId string, size, page int) ([]Env, error)

func (*EnvService) PutEnvironmentEnv

func (es *EnvService) PutEnvironmentEnv(organizationId, appId, environmentId string, secretKeyId int64, env Env) error

type EnvServicer

type EnvServicer interface {
	GetEnvironment(organizationId, projectId, environment string) (Environment, bool, error)
	PutEnvironmentEnv(organizationId, appId, environmentId string, secretKeyId int64, env Env) error
	GetEnvironmentEnv(organizationId, appId, environmentId string, secretKeyId *int64, version *int) (Env, error)
	ListEnvs(organizationId, appId string, size, page int) ([]Env, error)
	ListEnvVersions(organizationId, appId, environmentId string, size, page int) ([]Env, error)
	ListEnvironments(organizationId, projectId string, size, page int) ([]Environment, error)
}

type Environment

type Environment struct {
	ID           string       `json:"id"`
	AlternateID  string       `json:"alternateId"`
	Name         string       `json:"name"`
	Color        string       `json:"color"`
	Organization Organization `json:"organization"`
	Project      Project      `json:"project"`
}

type MockEnvService

type MockEnvService struct {
	mock.Mock
}

MockEnvService is a mock implementation of the EnvServicer interface

func NewMockEnvService

func NewMockEnvService() *MockEnvService

NewMockEnvService creates a new instance of MockEnvService

func (*MockEnvService) GetEnv

func (m *MockEnvService) GetEnv(organizationId, appId, env string) (Env, error)

GetEnv mocks the GetEnv method

func (*MockEnvService) GetEnvironment

func (m *MockEnvService) GetEnvironment(organizationId, appId, env string) (Environment, bool, error)

GetEnvironment mocks the GetEnvironment method

func (*MockEnvService) ListEnvs

func (m *MockEnvService) ListEnvs(organizationId, appId string, size, page int) ([]Env, error)

ListEnvs mocks the ListEnvs method

func (*MockEnvService) PutEnv

func (m *MockEnvService) PutEnv(organizationId, appId, env string) error

PutEnv mocks the PutEnv method

type Organization

type Organization struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type Project

type Project struct {
	ID          string `json:"id"`
	AlternateID string `json:"alternateId"`
	Name        string `json:"name"`
}

type ProjectEnvironment

type ProjectEnvironment struct {
	ID          string `json:"id"`
	AlternateID string `json:"alternateId"`
	Name        string `json:"name"`
}

Jump to

Keyboard shortcuts

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