config

package
v0.0.0-...-55990d1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const AuthServerDefaultClientID = "reearth-authsrv-client-default"

Variables

This section is empty.

Functions

This section is empty.

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) AuthConfigForM2M

func (c Auth0Config) AuthConfigForM2M() *AuthConfig

func (Auth0Config) AuthConfigForWeb

func (c Auth0Config) AuthConfigForWeb() *AuthConfig

func (Auth0Config) Configs

func (c Auth0Config) Configs() (res AuthConfigs)

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 AuthProvider

type AuthProvider interface {
	Configs() AuthConfigs
}

type AuthSrvConfig

type AuthSrvConfig struct {
	Dev      bool             `pp:",omitempty"`
	Disabled bool             `pp:",omitempty"`
	Issuer   string           `pp:",omitempty"`
	Domain   string           `pp:",omitempty"`
	UIDomain string           `pp:",omitempty"`
	Key      string           `pp:",omitempty"`
	DN       *AuthSrvDNConfig `pp:",omitempty"`
}

func (AuthSrvConfig) AuthConfig

func (c AuthSrvConfig) AuthConfig(debug bool, host string) *AuthConfig

func (AuthSrvConfig) DomainURL

func (c AuthSrvConfig) DomainURL() *url.URL

func (AuthSrvConfig) UIDomainURL

func (c AuthSrvConfig) UIDomainURL() *url.URL

type AuthSrvDNConfig

type AuthSrvDNConfig struct {
	CN         string   `pp:",omitempty"`
	O          []string `pp:",omitempty"`
	OU         []string `pp:",omitempty"`
	C          []string `pp:",omitempty"`
	L          []string `pp:",omitempty"`
	ST         []string `pp:",omitempty"`
	Street     []string `pp:",omitempty"`
	PostalCode []string `pp:",omitempty"`
}

func (*AuthSrvDNConfig) AuthServerDNConfig

func (a *AuthSrvDNConfig) AuthServerDNConfig() *authserver.DNConfig

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

type Config

type Config struct {
	mailer.Config
	Port             string            `default:"8080" envconfig:"PORT"`
	ServerHost       string            `pp:",omitempty"`
	Host             string            `default:"http://localhost:8080"`
	Host_Web         string            `pp:",omitempty"`
	Dev              bool              `pp:",omitempty"`
	DB               string            `default:"mongodb://localhost"`
	DB_Account       string            `pp:",omitempty"`
	DB_Users         []appx.NamedURI   `pp:",omitempty"`
	GraphQL          GraphQLConfig     `pp:",omitempty"`
	Published        PublishedConfig   `pp:",omitempty"`
	GCPProject       string            `envconfig:"GOOGLE_CLOUD_PROJECT" pp:",omitempty"`
	Profiler         string            `pp:",omitempty"`
	Tracer           string            `pp:",omitempty"`
	TracerSample     float64           `pp:",omitempty"`
	Marketplace      MarketplaceConfig `pp:",omitempty"`
	AssetBaseURL     string            `default:"http://localhost:8080/assets"`
	Origins          []string          `pp:",omitempty"`
	Policy           PolicyConfig      `pp:",omitempty"`
	Web_Disabled     bool              `pp:",omitempty"`
	Web_App_Disabled bool              `pp:",omitempty"`
	Web              map[string]string `pp:",omitempty"`
	Web_Config       JSON              `pp:",omitempty"`
	Web_Title        string            `pp:",omitempty"`
	Web_FaviconURL   string            `pp:",omitempty"`
	SignupSecret     string            `pp:",omitempty"`
	SignupDisabled   bool              `pp:",omitempty"`
	HTTPSREDIRECT    bool              `pp:",omitempty"`

	// storage
	GCS GCSConfig `pp:",omitempty"`
	S3  S3Config  `pp:",omitempty"`

	// auth
	Auth          AuthConfigs   `pp:",omitempty"`
	Auth0         Auth0Config   `pp:",omitempty"`
	Cognito       CognitoConfig `pp:",omitempty"`
	AuthSrv       AuthSrvConfig `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"`

	// system extensions
	Ext_Plugin []string `pp:",omitempty"`
}

func ReadConfig

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

func (*Config) AuthConfigs

func (c *Config) AuthConfigs() []AuthProvider

func (*Config) AuthForWeb

func (c *Config) AuthForWeb() *AuthConfig

func (*Config) Auths

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

func (*Config) HostURL

func (c *Config) HostURL() *url.URL

func (*Config) HostWebURL

func (c *Config) HostWebURL() *url.URL

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"`
}

func (GCSConfig) IsConfigured

func (g GCSConfig) IsConfigured() bool

type GraphQLConfig

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

type JSON

type JSON struct {
	Data any `pp:",omitempty"`
}

func (*JSON) Decode

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

type Mailer

type Mailer mailer.Mailer

type MarketplaceConfig

type MarketplaceConfig struct {
	Endpoint string                        `pp:",omitempty"`
	Secret   string                        `pp:",omitempty"`
	OAuth    *OAuthClientCredentialsConfig `pp:",omitempty"`
}

type OAuthClientCredentialsConfig

type OAuthClientCredentialsConfig struct {
	ClientID     string   `pp:",omitempty"`
	ClientSecret string   `pp:",omitempty"`
	TokenURL     string   `pp:",omitempty"`
	Scopes       []string `pp:",omitempty"`
	Audience     []string `pp:",omitempty"`
}

func (*OAuthClientCredentialsConfig) Config

type PolicyConfig

type PolicyConfig struct {
	Default *policy.ID `pp:",omitempty"`
}

type PublishedConfig

type PublishedConfig struct {
	IndexURL *url.URL `pp:",omitempty"`
	Host     string   `pp:",omitempty"`
}

type S3Config

type S3Config struct {
	BucketName              string
	PublicationCacheControl string
}

func (S3Config) IsConfigured

func (s S3Config) IsConfigured() bool

Jump to

Keyboard shortcuts

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