config

package
v0.0.0-...-fbe9a17 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadConfig

func LoadConfig()

LoadConfig loads the config file from disk.

Types

type ClientsConfig

type ClientsConfig struct {
	DynamicRegistration bool
}

type Config

type Config struct {
	Server   *ServerConfig
	Database *DatabaseConfig
	OAuth    *OAuthConfig
	Remain   map[string]interface{} `mapstructure:",remain"`
}

Config holds configuration information for the program.

var (
	// Current is the current configuration for the server.
	Current Config
)

func (Config) DefaultScopes

func (c Config) DefaultScopes() ([]*model.Scope, error)

DefaultScopes returns the default user scopes of this config.

func (Config) DefaultSigningKey

func (config Config) DefaultSigningKey() *jwt.Key

DefaultSigningKey returns the server's default key used for token signing.

func (Config) DefaultVerificationKey

func (config Config) DefaultVerificationKey() *jwt.Key

DefaultVerificationKey returns the server's default key used for token verifications.

func (Config) GetKeyForAlgorithm

func (config Config) GetKeyForAlgorithm(alg jwt.Algorithm, private bool) (*jwt.Key, error)

GetKeyForAlgorithm returns a cached key for the algorithm.

func (Config) JWKS

func (config Config) JWKS(private bool) *jwt.KeySet

JWKS returns the config's JSON Web Key Set.

func (*Config) SupportedAlgorithms

func (config *Config) SupportedAlgorithms() []jwt.Algorithm

SupportedAlgorithms returns a list of all supported signing algorithms.

type DatabaseConfig

type DatabaseConfig struct {
	// The GraphQL endpoint
	URL string

	// The Dgraph gRPC endpoint
	Grpc string

	// The GraphQL API key
	APIKey string

	// Whether or not to seed the DB
	SeedDB bool

	// Whether to drop all data
	DropAll bool

	// For embedded DB
	Dir string // Path to store data in (for embedded)
}

DatabaseConfig holds configuration variables for the database.

type OAuthConfig

type OAuthConfig struct {
	Admin struct {
		ClientID string // can be assigned or randomly generated
		Username string
		Password string
	}
	Clients ClientsConfig
	Tokens  struct {
		PrivateKeyFile   string
		DefaultAlgorithm jwt.Algorithm
		KeySet           map[jwt.Algorithm]TokenConfig
	}
	Scopes struct {
		Default string
	}
	Authentication struct {
		ROPC bool
	}
	Template struct {
		Options *templateOptions
	}
}

OAuthConfig holds configuration variables for FTAuth

type ServerConfig

type ServerConfig struct {
	Name   string
	Scheme string
	Host   string
	Port   string
}

ServerConfig holds configuration variables for the server.

func (*ServerConfig) URL

func (s *ServerConfig) URL() string

URL returns the main gateway URL for the server.

type TokenConfig

type TokenConfig struct {
	PrivateKey *jwt.Key
	PublicKey  *jwt.Key
}

TokenConfig holds settings for each JWT signing token.

Jump to

Keyboard shortcuts

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