Documentation ¶
Index ¶
- Constants
- func Bind(c *gin.Context, obj interface{}) error
- func CreateDBIfNotExists(c *Config) (int, error)
- func DecBytesFromB64(str string) ([]byte, error)
- func DecFromB64(str string) (string, error)
- func EncToB64(str string) string
- func GetDB() (*gorm.DB, error)
- func GetLogger() (hclog.Logger, error)
- func GetRequestPath(c *gin.Context) string
- func JSONMiddleware(replaceExistingContentType bool) gin.HandlerFunc
- func ParseBool(str string, def bool) bool
- func ParseInt(str string, def int) int
- func RequestIDMiddleware() gin.HandlerFunc
- func TrimPrefix(s string, pref string) string
- func VerifyCreateAccess(c *gin.Context) bool
- func VerifyListAccess(c *gin.Context) bool
- type CommonError
- type Config
- type GenericResponse
- type GenericResponseSerializer
- type LogConfig
- type Params
- type StatusResponse
- type TLSConfig
Constants ¶
View Source
const ( ENV_HOSTNAME = "HOSTNAME" ENV_PREFIX = "VAULT_AUTO_UNSEAL" ENV_HOST = "HOST" ENV_PORT = "PORT" ENV_TLS_CA_CRT_PATH = "CA_CRT_PATH" ENV_TLS_CLIENT_CA_CRT_PATH = "CLIENT_CA_CRT_PATH" ENV_TLS_CRT_PATH = "TLS_CRT_PATH" ENV_TLS_KEY_PATH = "TLS_KEY_PATH" ENV_DB_PATH = "DB_PATH" ENV_DB_NAME = "DB_NAME" ENV_LOG_FORMAT = "LOG_FORMAT" ENV_LOG_LEVEL = "LOG_LEVEL" ENV_PRODUCTION = "PRODUCTION" )
All currently used ENV VARS Used in the following form: <ENV_PREFIX>_<ENV_VAR>
View Source
const ( INIT_DB_RES_ERROR = 0 INIT_DB_RES_EXISTED = 1 INIT_DB_RES_CREATED = 2 )
View Source
const ( VAULT_TOKEN_HEADER = "X-Vault-Token" VAULT_TOKEN = "vaultToken" VAULT_TOKEN_MODEL = "vaultTokenModel" SESSION_POLICIES = "sessionPolicies" PATH_CAPABILITIES = "pathCapabilities" IS_ROOT = "isRoot" )
Context keys
Variables ¶
This section is empty.
Functions ¶
func CreateDBIfNotExists ¶
Create db file if it doesn't exist
func DecBytesFromB64 ¶
func DecFromB64 ¶
func GetRequestPath ¶
func JSONMiddleware ¶
func JSONMiddleware(replaceExistingContentType bool) gin.HandlerFunc
func ParseBool ¶
Parse Int - parsing integers from strings If error is received during parsing process it'll return the default value
func ParseInt ¶
Parse Int - parsing integers from strings If error is received during parsing process it'll return the default value
func RequestIDMiddleware ¶
func RequestIDMiddleware() gin.HandlerFunc
func TrimPrefix ¶
func VerifyCreateAccess ¶
Verify create acces on individual path
func VerifyListAccess ¶
Verify create acces on individual path
Types ¶
type CommonError ¶
type CommonError struct {
Errors []string `json:"errors"`
}
My own Error type that will help return my customized Error info
{"database": {"hello":"no such table", error: "not_exists"}}
type Config ¶
type Config struct { Lock sync.RWMutex Args *Params TLS *TLSConfig Logger hclog.Logger DBStatus int DB *gorm.DB }
App Config Struct
type GenericResponse ¶
type GenericResponse struct { RequestID string `json:"request_id"` LeaseID string `json:"lease_id"` LeaseDuration int `json:"lease_duration"` Renewable bool `json:"renewable"` Warnings *[]string `json:"warnings"` Data interface{} `json:"data"` WrapInfo *interface{} `json:"wrap_info"` Auth *interface{} `json:"auth"` }
func NewGenericResponse ¶
func NewGenericResponse(c *gin.Context, data interface{}) GenericResponse
type GenericResponseSerializer ¶
func (*GenericResponseSerializer) Response ¶
func (s *GenericResponseSerializer) Response(data interface{}) GenericResponse
type Params ¶
type Params struct { Host string Port int DBPath string DBName string IsProduction bool LogConfig *LogConfig }
App params provided during startup This struct is inialized only once, during startup It's should remain unchanged
type StatusResponse ¶
func NewStatusResponse ¶
func NewStatusResponse(code int, status string) StatusResponse
Click to show internal directories.
Click to hide internal directories.