server

package
v0.8.1-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: Apache-2.0 Imports: 56 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ConfigFileName = "config"
)

Functions

func Migrate

func Migrate(c *Config) error

Migrate runs the schema migration scripts

func RunServer

func RunServer(config *Config) error

RunServer runs the application server

Types

type Auth

type Auth struct {
	Provider string        `mapstructure:"provider" default:"default"`
	Default  DefaultAuth   `mapstructure:"default"`
	OIDC     auth.OIDCAuth `mapstructure:"oidc"`
}

type Config

type Config struct {
	Port                   int              `mapstructure:"port" default:"8080"`
	GRPC                   GRPCConfig       `mapstructure:"grpc"`
	EncryptionSecretKeyKey string           `mapstructure:"encryption_secret_key"`
	Notifier               notifiers.Config `mapstructure:"notifier"`
	LogLevel               string           `mapstructure:"log_level" default:"info"`
	DB                     store.Config     `mapstructure:"db"`
	// Deprecated: use Auth.Default.HeaderKey instead note on the AuthenticatedUserHeaderKey
	AuthenticatedUserHeaderKey string         `mapstructure:"authenticated_user_header_key"`
	AuditLogTraceIDHeaderKey   string         `mapstructure:"audit_log_trace_id_header_key" default:"X-Trace-Id"`
	Jobs                       Jobs           `mapstructure:"jobs"`
	Telemetry                  tracing.Config `mapstructure:"telemetry"`
	Auth                       Auth           `mapstructure:"auth"`
}

func LoadConfig

func LoadConfig(configFile string) (Config, error)

type DefaultAuth

type DefaultAuth struct {
	HeaderKey string `mapstructure:"header_key" default:"X-Auth-Email"`
}

type GRPCConfig added in v0.7.9

type GRPCConfig struct {
	// TimeoutInSeconds is the maximum time in seconds a request can take before being cancelled. Default = 5
	TimeoutInSeconds int `mapstructure:"timeout_in_seconds" default:"5"`
	// MaxCallRecvMsgSize is the maximum message size the server can receive in bytes. Default = 1 << 25 (32MB)
	MaxCallRecvMsgSize int `mapstructure:"max_call_recv_msg_size" default:"33554432"`
	// MaxCallSendMsgSize is the maximum message size the server can send in bytes. Default = 1 << 25 (32MB)
	MaxCallSendMsgSize int `mapstructure:"max_call_send_msg_size" default:"33554432"`
}

type Jobs

type Jobs struct {
	FetchResources             jobs.Job `mapstructure:"fetch_resources"`
	RevokeExpiredGrants        jobs.Job `mapstructure:"revoke_expired_grants"`
	ExpiringGrantNotification  jobs.Job `mapstructure:"expiring_grant_notification"`
	RevokeGrantsByUserCriteria jobs.Job `mapstructure:"revoke_grants_by_user_criteria"`
	GrantDormancyCheck         jobs.Job `mapstructure:"grant_dormancy_check"`
}

type ServiceDeps

type ServiceDeps struct {
	Config *Config
	// TODO: make items below as options
	Logger    log.Logger
	Validator *validator.Validate
	Notifier  notifiers.Client
	Crypto    domain.Crypto
}

type Services

type Services struct {
	ResourceService *resource.Service
	ActivityService *activity.Service
	ProviderService *provider.Service
	PolicyService   *policy.Service
	ApprovalService *approval.Service
	AppealService   *appeal.Service
	GrantService    *grant.Service
}

func InitServices

func InitServices(deps ServiceDeps) (*Services, error)

Jump to

Keyboard shortcuts

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