Documentation ¶
Index ¶
- Constants
- type Secrets
- func (s *Secrets) Export() (_ []byte, err error)
- func (s *Secrets) ExportEnv(env *yamlSecure) (_ []byte, err error)
- func (s *Secrets) GenerateKey() error
- func (s *Secrets) Import(ciphertext []byte) error
- func (s *Secrets) ImportToEnv(ciphertext []byte, env *yamlSecure) error
- func (s *Secrets) Key64() string
- func (s *Secrets) ReadKey(file string) error
- func (s *Secrets) SaveKey(file string) error
- func (s *Secrets) SetKey64(key64 string) (err error)
- type Secure
- func (d *Secure) DefineDefaultCredFileName(aPath, env string) string
- func (d *Secure) DefineDefaultSecretFileName(aPath, env string) string
- func (d *Secure) DirName(env string) (_ string)
- func (d *Secure) EncryptAll(encrypt bool) error
- func (d *Secure) Get(objName, instanceName, keyName string) (value *Value, found bool, source, env string)
- func (d *Secure) GetForjValue(env, key string) (_ string, _ bool)
- func (d *Secure) GetGlobal(objName, instanceName, keyName string) (value *Value, found bool, source, env string)
- func (d *Secure) GetGlobalString(objName, instanceName, keyName string) (value string, found bool, source, env string)
- func (d *Secure) GetObjectInstance(objName, instanceName string) (values map[string]*Value)
- func (d *Secure) GetSecrets(env string) (result *Secrets)
- func (d *Secure) GetString(objName, instanceName, keyName string) (value string, found bool, source, env string)
- func (d *Secure) InitEnvDefaults(aPath, env string)
- func (d *Secure) IsLoaded(env string) (_ bool)
- func (d *Secure) Load() error
- func (d *Secure) Save() error
- func (d *Secure) SaveEnv(env string) error
- func (d *Secure) SetDefaultFile(env string)
- func (d *Secure) SetFile(filePath, env string)
- func (d *Secure) SetForjValue(env, source, key string, value *Value) (_ bool, _ error)
- func (d *Secure) SetGetterHandler(key string, getter func(v *YamlValue) (string, error))
- func (d *Secure) SetObjectValue(env, source, obj_name, instance_name, key_name string, value *Value) (_ bool)
- func (d *Secure) SetSetterHandler(key string, setter func(v *Value, value *goforjj.ValueStruct) error)
- func (d *Secure) UnsetObjectValue(env, objName, instanceName, keyName string) (_ bool)
- func (d *Secure) Upgrade(v0Func func(*Secure, string) error) (_ error)
- func (d *Secure) Version(env string) (_ string)
- type Value
- func (v *Value) AddResource(key, value string)
- func (v Value) Clone() (ret *YamlValue)
- func (v *Value) GetResource(key string) (value string, found bool)
- func (v *Value) GetSource() string
- func (v *Value) GetString() (_ string, err error)
- func (v Value) MarshalYAML() (interface{}, error)
- func (v *Value) Set(source string, value *goforjj.ValueStruct) (err error)
- func (v *Value) SetSource(source string)
- func (v *Value) SetValue(value interface{})
- func (v *Value) UnmarshalYAML(unmarchal func(interface{}) error) (err error)
- type YamlValue
Constants ¶
const ( DefaultCredsFile = "forjj-creds.yml" DefaultSecretFile = "forjj.enc" DefaultSecretKeyFile = ".forjj.key" Global = "global" )
DefaultCredsFile is the default credential file name, without environment information.
const ( // Internal represents the forjj internal storage Internal = "internal" // Link represents the file link storage. Link = "link" )
const (
// CredsVersion is the latest supported version of Forjj secrets files.
CredsVersion = "0.2"
)
const KeySize = 32
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Secrets ¶
type Secrets struct { Envs map[string]*yamlSecure `yaml:";inline"` // contains filtered or unexported fields }
Secrets is internal secret structured shared with ci to run forjj jobs
func NewSecrets ¶
func NewSecrets() (ret *Secrets)
NewSecrets creates the internal secret object to shared with CI running infra/deploy repositories.
func (*Secrets) GenerateKey ¶
GenerateKey help to create a random key for the encryption
func (*Secrets) ImportToEnv ¶
ImportToEnv read an encrypted data, decrypt it and save it in the given Env.
type Secure ¶
type Secure struct {
// contains filtered or unexported fields
}
Secure is the master object to control Forjj security information.
func (*Secure) DefineDefaultCredFileName ¶
DefineDefaultCredFileName define the internal credential path file for a specific environment.
func (*Secure) DefineDefaultSecretFileName ¶
DefineDefaultSecretFileName define the internal credential path file for a specific environment.
func (*Secure) EncryptAll ¶
EncryptAll is executed to encrypt all unencrypted files if found. The process is as follow:
if one uncrypted file is found, and no encrypted found, the file will be encrypted, automatically if both unencrypted and encrrypted files are found, it removes the unencrypted file if only encrypted file is found, nothing is done
If error is found, the function exit.
func (*Secure) Get ¶
func (d *Secure) Get(objName, instanceName, keyName string) (value *Value, found bool, source, env string)
Get value of the object instance key...
func (*Secure) GetForjValue ¶
GetForjValue get a value from the 'forj' section.
func (*Secure) GetGlobal ¶
func (d *Secure) GetGlobal(objName, instanceName, keyName string) (value *Value, found bool, source, env string)
GetGlobal get value of the object instance key in the globql space...
func (*Secure) GetGlobalString ¶
func (d *Secure) GetGlobalString(objName, instanceName, keyName string) (value string, found bool, source, env string)
GetGlobalString return a string representation of the value.
func (*Secure) GetObjectInstance ¶
GetObjectInstance return the instance data
func (*Secure) GetSecrets ¶
GetSecrets Clone the secrets which is returned.
func (*Secure) GetString ¶
func (d *Secure) GetString(objName, instanceName, keyName string) (value string, found bool, source, env string)
GetString return a string representation of the value whatever resource is providing the data (forjj data, files, ...)
func (*Secure) InitEnvDefaults ¶
InitEnvDefaults initialize the internal cred module with file path. the file is prefixed by the deployment environment name.
func (*Secure) SetDefaultFile ¶
SetDefaultFile creates the file information.
func (*Secure) SetFile ¶
SetFile load a single file for the env given. if env is 'global', so data is considered as valid for all environment.
func (*Secure) SetForjValue ¶
SetForjValue set a value in Forj section.
func (*Secure) SetGetterHandler ¶
SetGetterHandler set getter types like 'link'
func (*Secure) SetObjectValue ¶
func (d *Secure) SetObjectValue(env, source, obj_name, instance_name, key_name string, value *Value) (_ bool)
SetObjectValue set object value
func (*Secure) SetSetterHandler ¶
func (d *Secure) SetSetterHandler(key string, setter func(v *Value, value *goforjj.ValueStruct) error)
SetSetterHandler set setter types like 'link'
func (*Secure) UnsetObjectValue ¶
UnsetObjectValue remove the object value
type Value ¶
type Value struct {
// contains filtered or unexported fields
}
ObjectValue describe the Objects keys value
func NewValue ¶
func NewValue(source string, value *goforjj.ValueStruct) (ret *Value)
NewValue creates a new Value object, initialized with a ValueStruct if needed.
func (*Value) AddResource ¶
AddResource adds resources information to the data given
func (*Value) GetResource ¶
GetResource return the resource value
func (Value) MarshalYAML ¶
MarshalYAML encode the object in ValueStruct output
func (*Value) Set ¶
func (v *Value) Set(source string, value *goforjj.ValueStruct) (err error)
Set source andvalue of a Value instance
func (*Value) SetValue ¶
func (v *Value) SetValue(value interface{})
SetValue set the value of a Value instance
func (*Value) UnmarshalYAML ¶
UnmarshalYAML decode the flow as a ValueStruct