app

package
v0.0.0-...-2b2b6fc Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 70 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthRequiredMiddleware

func AuthRequiredMiddleware() echo.MiddlewareFunc

func ContextMiddleware

func ContextMiddleware(fn func(ctx context.Context) context.Context) echo.MiddlewareFunc

func GraphqlAPI

func GraphqlAPI(conf GraphQLConfig, dev bool) echo.HandlerFunc

func M2MAuthMiddleware

func M2MAuthMiddleware(cfg *Config) echo.MiddlewareFunc

func NewLogMonitor

func NewLogMonitor() *event.CommandMonitor

func NotifyHandler

func NotifyHandler() echo.HandlerFunc

func Ping

func Ping() echo.HandlerFunc

func PublicAPIAuthMiddleware

func PublicAPIAuthMiddleware(cfg *ServerConfig) echo.MiddlewareFunc

func Signup

func Signup() echo.HandlerFunc

func Start

func Start(debug bool, version string)

func UsecaseMiddleware

func UsecaseMiddleware(r *repo.Container, g *gateway.Container, ar *accountrepo.Container, ag *accountgateway.Container, config interactor.ContainerConfig) echo.MiddlewareFunc

func Web

func Web(e *echo.Echo, config map[string]any, disabled bool, fs afero.Fs)

Types

type Auth0Config

type Auth0Config struct {
	Domain       string `pp:",omitempty"`
	Audience     string `pp:",omitempty"`
	ClientID     string `pp:",omitempty"`
	ClientSecret string `pp:",omitempty"`
	WebClientID  string `pp:",omitempty"`
}

func (Auth0Config) AuthConfig

func (c Auth0Config) AuthConfig() *AuthConfig

func (Auth0Config) AuthConfigForWeb

func (c Auth0Config) AuthConfigForWeb() *AuthConfig

type AuthConfig

type AuthConfig struct {
	ISS      string   `pp:",omitempty"`
	AUD      []string `pp:",omitempty"`
	ALG      *string  `pp:",omitempty"`
	TTL      *int     `pp:",omitempty"`
	ClientID *string  `pp:",omitempty"`
	JWKSURI  *string  `pp:",omitempty"`
}

func (AuthConfig) JWTProvider

func (a AuthConfig) JWTProvider() appx.JWTProvider

type AuthConfigs

type AuthConfigs []AuthConfig

func (*AuthConfigs) Decode

func (ipd *AuthConfigs) Decode(value string) error

Decode is a custom decoder for AuthConfigs

func (AuthConfigs) JWTProviders

func (a AuthConfigs) JWTProviders() []appx.JWTProvider

type AuthM2MConfig

type AuthM2MConfig struct {
	ISS     string   `pp:",omitempty"`
	AUD     []string `pp:",omitempty"`
	ALG     *string  `pp:",omitempty"`
	TTL     *int     `pp:",omitempty"`
	Email   string   `pp:",omitempty"`
	JWKSURI *string  `pp:",omitempty"`
}

func (AuthM2MConfig) JWTProvider

func (a AuthM2MConfig) JWTProvider() []appx.JWTProvider

type CognitoConfig

type CognitoConfig struct {
	UserPoolID string `pp:",omitempty"`
	Region     string `pp:",omitempty"`
	ClientID   string `pp:",omitempty"`
}

func (CognitoConfig) Configs

func (c CognitoConfig) Configs() AuthConfigs

Cognito

type Config

type Config struct {
	Port         string            `default:"8080" envconfig:"PORT"`
	ServerHost   string            `pp:",omitempty"`
	Host         string            `default:"http://localhost:8080"`
	Dev          bool              `pp:",omitempty"`
	Host_Web     string            `pp:",omitempty"`
	GraphQL      GraphQLConfig     `pp:",omitempty"`
	Origins      []string          `pp:",omitempty"`
	DB           string            `default:"mongodb://localhost"`
	Mailer       string            `pp:",omitempty"`
	SMTP         SMTPConfig        `pp:",omitempty"`
	SendGrid     SendGridConfig    `pp:",omitempty"`
	SignupSecret string            `pp:",omitempty"`
	GCS          GCSConfig         `pp:",omitempty"`
	S3           S3Config          `pp:",omitempty"`
	Task         gcp.TaskConfig    `pp:",omitempty"`
	AWSTask      aws.TaskConfig    `pp:",omitempty"`
	AssetBaseURL string            `pp:",omitempty"`
	Web          map[string]string `pp:",omitempty"`
	Web_Config   JSON              `pp:",omitempty"`
	Web_Disabled bool              `pp:",omitempty"`
	// auth
	Auth          AuthConfigs   `pp:",omitempty"`
	Auth0         Auth0Config   `pp:",omitempty"`
	Cognito       CognitoConfig `pp:",omitempty"`
	Auth_ISS      string        `pp:",omitempty"`
	Auth_AUD      string        `pp:",omitempty"`
	Auth_ALG      *string       `pp:",omitempty"`
	Auth_TTL      *int          `pp:",omitempty"`
	Auth_ClientID *string       `pp:",omitempty"`
	Auth_JWKSURI  *string       `pp:",omitempty"`
	// auth for m2m
	AuthM2M AuthM2MConfig `pp:",omitempty"`

	DB_Account string          `pp:",omitempty"`
	DB_Users   []appx.NamedURI `pp:",omitempty"`
}

func ReadConfig

func ReadConfig(debug bool) (*Config, error)

func (*Config) AuthForWeb

func (c *Config) AuthForWeb() *AuthConfig

func (*Config) Auths

func (c *Config) Auths() (res AuthConfigs)

func (*Config) JWTProviders

func (c *Config) JWTProviders() (res []appx.JWTProvider)

func (*Config) Print

func (c *Config) Print() string

func (*Config) WebConfig

func (c *Config) WebConfig() map[string]any

type GCSConfig

type GCSConfig struct {
	BucketName              string `pp:",omitempty"`
	PublicationCacheControl string `pp:",omitempty"`
}

type GraphQLConfig

type GraphQLConfig struct {
	ComplexityLimit int `default:"6000"`
}

type JSON

type JSON struct {
	Data any
}

func (*JSON) Decode

func (j *JSON) Decode(value string) error

func (*JSON) Object

func (j *JSON) Object() map[string]any

type S3Config

type S3Config struct {
	BucketName              string `pp:",omitempty"`
	PublicationCacheControl string `pp:",omitempty"`
}

type SMTPConfig

type SMTPConfig struct {
	Host         string `pp:",omitempty"`
	Port         string `pp:",omitempty"`
	SMTPUsername string `pp:",omitempty"`
	Email        string `pp:",omitempty"`
	Password     string `pp:",omitempty"`
}

type SendGridConfig

type SendGridConfig struct {
	Email string `pp:",omitempty"`
	Name  string `pp:",omitempty"`
	API   string `pp:",omitempty"`
}

type ServerConfig

type ServerConfig struct {
	Config     *Config
	Debug      bool
	Repos      *repo.Container
	Gateways   *gateway.Container
	AcRepos    *accountrepo.Container
	AcGateways *accountgateway.Container
}

type WebServer

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

func NewServer

func NewServer(ctx context.Context, cfg *ServerConfig) *WebServer

func (*WebServer) Run

func (w *WebServer) Run(ctx context.Context)

func (*WebServer) Serve

func (w *WebServer) Serve(l net.Listener) error

func (*WebServer) Shutdown

func (w *WebServer) Shutdown(ctx context.Context) error

Jump to

Keyboard shortcuts

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