serv

package
v0.16.37 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2021 License: Apache-2.0 Imports: 57 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	Name     string
	SQL      string
	AuthName string `mapstructure:"auth_name"`
}

Action struct contains config values for a GraphJin service action

type BuildInfo

type BuildInfo struct {
	Version string
	Commit  string
	Date    string
}

func GetBuildInfo

func GetBuildInfo() BuildInfo

type Config

type Config struct {
	Core `mapstructure:",squash"`
	Serv `mapstructure:",squash"`
	// contains filtered or unexported fields
}

Config struct holds the GraphJin config values

func ReadInConfig

func ReadInConfig(configFile string) (*Config, error)

ReadInConfig function reads in the config file for the environment specified in the GO_ENV environment variable. This is the best way to create a new GraphJin config.

func (*Config) RelPath

func (c *Config) RelPath(p string) string

type Core

type Core = core.Config

type Serv

type Serv struct {
	AppName        string `mapstructure:"app_name"`
	Production     bool
	LogLevel       string `mapstructure:"log_level"`
	LogFormat      string `mapstructure:"log_format"`
	HostPort       string `mapstructure:"host_port"`
	Host           string
	Port           string
	HTTPGZip       bool     `mapstructure:"http_compress"`
	WebUI          bool     `mapstructure:"web_ui"`
	EnableTracing  bool     `mapstructure:"enable_tracing"`
	WatchAndReload bool     `mapstructure:"reload_on_config_change"`
	AuthFailBlock  bool     `mapstructure:"auth_fail_block"`
	SeedFile       string   `mapstructure:"seed_file"`
	MigrationsPath string   `mapstructure:"migrations_path"`
	AllowedOrigins []string `mapstructure:"cors_allowed_origins"`
	AllowedHeaders []string `mapstructure:"cors_allowed_headers"`
	DebugCORS      bool     `mapstructure:"cors_debug"`
	APIPath        string   `mapstructure:"api_path"`
	CacheControl   string   `mapstructure:"cache_control"`

	// Telemetry struct contains OpenCensus metrics and tracing related config
	Telemetry struct {
		Debug    bool
		Interval *time.Duration
		Metrics  struct {
			Exporter  string
			Endpoint  string
			Namespace string
			Key       string
		}

		Tracing struct {
			Exporter      string
			Endpoint      string
			Sample        string
			IncludeQuery  bool `mapstructure:"include_query"`
			IncludeParams bool `mapstructure:"include_params"`
		}
	}

	Auth  auth.Auth
	Auths []auth.Auth

	// DB struct contains db config
	DB struct {
		Type        string
		Host        string
		Port        uint16
		DBName      string
		User        string
		Password    string
		Schema      string
		PoolSize    int32         `mapstructure:"pool_size"`
		MaxRetries  int           `mapstructure:"max_retries"`
		PingTimeout time.Duration `mapstructure:"ping_timeout"`
		EnableTLS   bool          `mapstructure:"enable_tls"`
		ServerName  string        `mapstructure:"server_name"`
		ServerCert  string        `mapstructure:"server_cert"`
		ClientCert  string        `mapstructure:"client_cert"`
		ClientKey   string        `mapstructure:"client_key"`
	} `mapstructure:"database"`

	Actions []Action

	RateLimiter struct {
		Rate     float64
		Bucket   int
		IPHeader string `mapstructure:"ip_header"`
	} `mapstructure:"rate_limiter"`
}

Serv struct contains config values used by the GraphJin service

type Service

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

func NewService

func NewService(conf *Config) (*Service, error)

func (*Service) Attach

func (s *Service) Attach(mux *http.ServeMux) error

func (*Service) NewDB

func (s *Service) NewDB() (*sql.DB, error)

func (*Service) Start

func (s *Service) Start() error

Directories

Path Synopsis
module
internal

Jump to

Keyboard shortcuts

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