utils

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AesEncryptKey = "tcr-access-control-secret-012345" // 32 bytes length
)

Variables

View Source
var (
	SECRET_ID_ENV_NAME   = "TENCENT_CLOUD_SECRET_ID"
	SECRET_KEY_ENV_NAME  = "TENCENT_CLOUD_SECRET_KEY"
	REGION_ENV_NAME      = "TENCENT_CLOUD_REGION"
	REGISTRY_ID_ENV_NAME = "TENCENT_CLOUD_REGISTRY_ID"

	// TAC_CONFIG_FILE_HOME is $HOME/.tcr_access_control.yaml
	TAC_CONFIG_FILE_HOME = filepath.FromSlash(os.Getenv("HOME") + "/.tcr_access_control.yaml")

	// TAC_CONFIG_FILE_GLOBAL is /etc/tcr-access-control/config.yaml
	TAC_CONFIG_FILE_GLOBAL = filepath.FromSlash("/etc/tcr-access-control/config.yaml")
)
View Source
var (
	ClientProfile *profile.ClientProfile
	Credential    *common.Credential
	Config        *config.Config
)
View Source
var (
	Version   = "v0.1.1"
	GitCommit = ""
)

Functions

func DecryptAES

func DecryptAES(key string, e string) (string, error)

func EncryptAES

func EncryptAES(key string, text string) (string, error)

func Init

func Init(configPath string) error

Init initializes the credential key and client profile

func Pointer

func Pointer[T valueTypes](i T) *T

Pointer gets the pointer of the variable.

func Value

func Value[T valueTypes](p *T) T

A safe function to get the value from the pointer.

Types

This section is empty.

Jump to

Keyboard shortcuts

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