cmd

package
v0.0.0-...-08daa4e Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddAllFlags

func AddAllFlags(c *cobra.Command)

AddAllFlags will add all the flags provided in this package to the provided command and will bind those flags with viper.

func AddConfigurationFlag

func AddConfigurationFlag(c *cobra.Command)

AddConfigurationFlag adds support to provide a configuration file on the command line.

func AddDatabaseFlags

func AddDatabaseFlags(c *cobra.Command)

func AddFrontFlags

func AddFrontFlags(c *cobra.Command)

func AddGlobalFlags

func AddGlobalFlags(c *cobra.Command)

func AddLoggerFlags

func AddLoggerFlags(c *cobra.Command)

AddLoggerFlags adds support to configure the level of the logger.

func AddPrometheusFlags

func AddPrometheusFlags(c *cobra.Command)

AddPrometheusFlags adds flags to support prometheus instrumentation.

func AddServerFlags

func AddServerFlags(c *cobra.Command)

AddServerFlags adds support to configure the server.

func NewLogger

func NewLogger(c *Conf) *zerolog.Logger

NewLogger will return a new logger

Types

type Conf

type Conf struct {
	Log        LogConf        `mapstructure:"log"`
	Server     ServerConf     `mapstructure:"server"`
	Front      FrontConf      `mapstructure:"front"`
	Prometheus PrometheusConf `mapstructure:"prometheus"`
	Database   DatabaseConf   `mapstructure:"database"`
	Register   bool           `mapstructure:"allow_register"`
}

func NewConf

func NewConf() (*Conf, error)

NewConf will parse and return the configuration

type CookieConf

type CookieConf struct {
	Domain string `mapstructure:"domain"`
	HTTPS  bool   `mapstructure:"https"`
}

type CorsConf

type CorsConf struct {
	Enable  bool     `mapstructure:"enable"`
	Methods []string `mapstructure:"methods"`
	Expose  []string `mapstructure:"expose"`
	Headers []string `mapstructure:"headers"`
	Origins []string `mapstructure:"origins"`
	All     bool     `mapstructure:"all"`
}

type DatabaseConf

type DatabaseConf struct {
	Path string `mapstructure:"path"`
}

type FrontConf

type FrontConf struct {
	Serve bool   `mapstructure:"serve"`
	Embed bool   `mapstructure:"embed"`
	Path  string `mapstructure:"path"`
}

type JWTConf

type JWTConf struct {
	Secret string `mapstructure:"secret"`
}

type LogConf

type LogConf struct {
	Level  string `mapstructure:"level"`
	Type   string `mapstructure:"type"`
	Caller bool   `mapstructure:"caller"`
}

type PrometheusConf

type PrometheusConf struct {
	Prefix   string `mapstructure:"prefix"`
	Disabled bool   `mapstructure:"disabled"`
}

type ServerConf

type ServerConf struct {
	Host   string     `mapstructure:"host"`
	Port   int        `mapstructure:"port"`
	Mode   string     `mapstructure:"mode"`
	Log    bool       `mapstructure:"log"`
	CORS   CorsConf   `mapstructure:"cors"`
	JWT    JWTConf    `mapstructure:"jwt"`
	Cookie CookieConf `mapstructure:"cookie"`
}

Jump to

Keyboard shortcuts

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