cmd

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2020 License: MIT Imports: 41 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildDetails

func BuildDetails() string

BuildDetails returns a string containing details about the JWTIS binary.

func ExecutableChecksum

func ExecutableChecksum() []byte

ExecutableChecksum returns a byte slice containing the SHA256 checksum of the executable. It returns a nil slice if there's an error trying to calculate the checksum.

func Register

func Register(app *cli.Cli, configBucket, envPrefix string)

Register executes root command through calling internal rootCmd.Bootstrap

func Version

func Version() string

Version returns a string containing the appVersion.

Types

type Cli

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

Cli represents the structure of a CLI app. It should be constructed using the App() function

func App

func App(name, desc string) *Cli

App creates a new and empty CLI app configured with the passed name and description. name and description will be used to construct the help message for the app:

Usage: $name [OPTIONS] COMMAND [arg...]
$desc

func (*Cli) Config

func (c *Cli) Config(bucket, envPrefix string)

Config sets internal values

func (*Cli) Run

func (c *Cli) Run(args []string) error

Run uses the app configuration (specs, commands, ...) to parse the args slice and to execute the matching command. In case of an incorrect usage, and depending on the configured ErrorHandling policy, it may return an error, panic or exit

func (*Cli) Version

func (c *Cli) Version(name, version string)

Version sets the version string of the CLI app together with the options that can be used to trigger printing the version string via the CLI.

Usage: appName --$name
$version

type Config

type Config struct {
	// defaults    `yaml:"-"`
	Options      `json:"Options" yaml:"Options"`
	StoreConfig  *StoreConfig  `json:"StoreConfig" yaml:"StoreConfig"`
	LoggerConfig *LoggerConfig `json:"LoggerConfig" yaml:"LoggerConfig"`
	// contains filtered or unexported fields
}

Config contains app option values

func NewConfig

func NewConfig(bucketName string) *Config

NewConfig returns initiated config instance

func (Config) GetStoreConfig

func (c Config) GetStoreConfig() (*store.Config, error)

GetStoreConfig converts internal config to *store.Config

type Encryption

type Encryption struct {
	EncAlg  *string `json:"EncAlg" yaml:"EncAlg"`   // Default algorithm to be used for encrypt
	EncBits *int    `json:"EncBits" yaml:"EncBits"` // Default key size in bits for encrypt
	ContEnc *string `json:"ContEnc" yaml:"ContEnc"` // Default Content Encryption
}

Encryption config

type GRPCConf added in v0.7.1

type GRPCConf struct {
	ListenGRPC     *string `json:"ListenGRPC" yaml:"ListenGRPC"`
	MaxRecvMsgSize int     `json:"MaxRecvMsgSize" yaml:"MaxRecvMsgSize"`
	MaxSendMsgSize int     `json:"MaxSendMsgSize" yaml:"MaxSendMsgSize"`
}

GRPCConf config

type HTTPConf

type HTTPConf struct {
	ListenMetrics *string `json:"ListenMetrics" yaml:"ListenMetrics"` // ip:port to listen to
	TLS           *bool   `json:"TLS" yaml:"TLS"`                     // Future feature
	TLSConfig     `json:"TLSConfig" yaml:"TLSConfig"`
}

HTTPConf config

type JwtTTL

type JwtTTL struct {
	AuthTTL    *string `json:"AuthTTL" yaml:"AuthTTL"`       // Default value for auth jwt ttl
	RefreshTTL *string `json:"RefreshTTL" yaml:"RefreshTTL"` // Default value for refresh jwt ttl
}

JwtTTL config

type KeyGeneration

type KeyGeneration struct {
	// keys generation options
	Sign       `json:"Sign" yaml:"Sign"`
	Encryption `json:"Encryption" yaml:"Encryption"`
	Expiry     *string `json:"Expiry" yaml:"Expiry"`
	JwtTTL     `json:"JwtTTL" yaml:"JwtTTL"`
}

KeyGeneration config

type LoggerConfig added in v0.7.1

type LoggerConfig struct {
	LogFileName  string `json:"LogFileName" yaml:"LogFileName"`   // file to write logs to
	LogMaxSize   int    `json:"LogMaxSize" yaml:"LogMaxSize"`     // megabytes
	LogMaxAge    int    `json:"LogMaxAge" yaml:"LogMaxAge"`       // maximum number of days to retain old log files
	LogMaxBackUp int    `json:"LogMaxBackUp" yaml:"LogMaxBackUp"` // maximum number of old log files to retain
	LogCompress  bool   `json:"LogCompress" yaml:"LogCompress"`   // determines if the rotated log files should be compressed
	LogLocalTime bool   `json:"LogLocalTime" yaml:"LogLocalTime"` // use local or UTC time in filename
	LogLevel     string `json:"LogLevel" yaml:"LogLevel"`         // priority is for config.Verbose
	LogFileSave  bool   `json:"LogFileSave" yaml:"LogFileSave"`
}

LoggerConfig contains lumberjack options

type MetricsConf added in v0.7.1

type MetricsConf struct {
	ListenMetrics  *string `json:"ListenMetrics" yaml:"ListenMetrics"` // ip:port to listen to
	GRPCHistogram  bool    `json:"GRPCHistogram" yaml:"GRPCHistogram"`
	DisableMetrics bool    `json:"DisableMetrics" yaml:"DisableMetrics"`
}

MetricsConf config

type Options

type Options struct {
	TLS           *bool `json:"TLS" yaml:"TLS"` // Future feature
	TLSConfig     `json:"TLSConfig" yaml:"TLSConfig"`
	GRPCConf      `json:"GrpcConf" yaml:"GrpcConf"`
	MetricsConf   `json:"MetricsConf" yaml:"MetricsConf"`
	KeyGeneration `json:"KeyGeneration" yaml:"KeyGeneration"`
	SelfName      *string `json:"SelfName" yaml:"SelfName"` // Name of this service

	// Later user must provide a password to access the database
	LogPath    *string `json:"LogPath" yaml:"LogPath"`
	DBConfig   *string `json:"DBConfig" yaml:"DBConfig"`
	ConfigFile *string `json:"ConfigFile" yaml:"ConfigFile"`
	Verbose    *bool   `json:"Verbose" yaml:"Verbose"`
	// contains filtered or unexported fields
}

Options config

type Sign

type Sign struct {
	SigAlg  *string `json:"SigAlg" yaml:"SigAlg"`   // Default algorithm to be used for sign
	SigBits *int    `json:"SigBits" yaml:"SigBits"` // Default key size in bits for sign
}

Sign holds default keys generation options

type StoreClientTLSConfig

type StoreClientTLSConfig struct {
	CertFile           string `json:"CertFile" yaml:"CertFile"`
	KeyFile            string `json:"KeyFile" yaml:"KeyFile"`
	CACertFile         string `json:"CACertFile" yaml:"CACertFile"`
	InsecureSkipVerify bool   `json:"InsecureSkipVerify" yaml:"InsecureSkipVerify"`
}

StoreClientTLSConfig config

type StoreConfig

type StoreConfig struct {
	ClientTLS *StoreClientTLSConfig `json:"ClientTLS" yaml:"ClientTLS"`
	// ConnectionTimeout is time.Duration in string format
	ConnectionTimeout string `json:"ConnectionTimeout" yaml:"ConnectionTimeout"`
	// SyncPeriod is time.Duration in string format
	SyncPeriod string `json:"SyncPeriod" yaml:"SyncPeriod"`
	// Bucket            string `json:"Bucket" yaml:"Bucket"`
	PersistConnection bool   `json:"PersistConnection" yaml:"PersistConnection"`
	Username          string `json:"Username" yaml:"Username"`
	Password          string `json:"Password" yaml:"Password"`
	Token             string `json:"Token" yaml:"Token"`
}

StoreConfig config

type TLSConfig

type TLSConfig struct {
	CertFile   *string `json:"CertFile" yaml:"CertFile"`
	KeyFile    *string `json:"KeyFile" yaml:"KeyFile"`
	CACertFile *string `json:"CACertFile" yaml:"CACertFile"`
}

TLSConfig config

Jump to

Keyboard shortcuts

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