utils

package
v0.0.0-...-84b4eae Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ProjectContextKeys the project's context keys
	ProjectContextKeys = ContextKeys{
		GothicProviderCtxKey: "provider",
		ProviderCtxKey:       "gg-provider",
		UserCtxKey:           "gg-auth-user",
	}
)

Functions

func MustGet

func MustGet(envName string) string

MustGet will return ENV variable, panic if not exists

func MustGetBool

func MustGetBool(envName string) bool

Types

type AuthProvider

type AuthProvider struct {
	Provider  string
	ClientKey string
	Secret    string
	Domain    string // If needed, like with auth0
	Scopes    []string
}

AuthProvider defines the configuration for the Goth config

type ContextKey

type ContextKey string

ContextKey defines a type for context keys shared in the app

type ContextKeys

type ContextKeys struct {
	GothicProviderCtxKey ContextKey // Provider for Gothic library
	ProviderCtxKey       ContextKey // Provider in Auth
	UserCtxKey           ContextKey // User db object in Auth
}

ContextKeys holds the context keys throughout the project

type GQLConfig

type GQLConfig struct {
	Path                string
	PlaygroundPath      string
	IsPlaygroundEnabled bool
}

GQLConfig defines the configuration for the GQL Server

type JWTConfig

type JWTConfig struct {
	Secret             string
	Algorithm          string
	AccessTokenExpire  string
	RefreshTokenExpire string
}

JWTConfig defines the options for JWT tokens

type MGDBConfig

type MGDBConfig struct {
	DSN string
}

MGDBConfig defines the configuration for the MongoDB config

type RedisConfig

type RedisConfig struct {
	EndPoint string
	PWD      string
}

type ServerConfig

type ServerConfig struct {
	Host          string
	Port          string
	URISchema     string //http:// or https://
	ApiVer        string
	StaticPath    string
	SessionSecret string
	CookiesDomain string
	JWT           JWTConfig
	GraphQL       GQLConfig
	MongoDB       MGDBConfig
	Redis         RedisConfig
	AuthProviders []AuthProvider
}

ServerConfig defines the configuration of server

func (*ServerConfig) ListenEndpoint

func (s *ServerConfig) ListenEndpoint() string

ListenEndpoint returns the endpoint string

func (*ServerConfig) RealSchemaVersioningEndpoint

func (s *ServerConfig) RealSchemaVersioningEndpoint(path string) string

func (*ServerConfig) SchemaVersioningEndpoint

func (s *ServerConfig) SchemaVersioningEndpoint(path string) string

SchemaVersioningEndpoint return the complete URI path

func (*ServerConfig) VersioningEndpoint

func (s *ServerConfig) VersioningEndpoint(path string) string

VersioningEndpoint retruns the versioning api path, path should have "/" as prefix

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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