config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// OAuth holds OAuth provider configs. Key is provider ID (e.g. "github"). When present and valid, that provider is enabled.
	OAuth OAuthConfig
	// AppOrigin is the public URL of the frontend (e.g. http://localhost:5173). When set, invite URLs and OAuth redirects use it; non-API requests to this server return 401 Unauthorized.
	AppOrigin string
}

Config holds optional server configuration (e.g. OAuth, app origin).

func LoadFromEnv

func LoadFromEnv() *Config

LoadFromEnv returns Config from environment variables. ENABLE_GITHUB_OAUTH (true/1), GITHUB_CLIENT_ID, GITHUB_CLIENT_SECRET enable GitHub OAuth. APP_ORIGIN sets the public app URL (OAuth redirects, signup links).

func (*Config) EnabledOAuthProviders

func (c *Config) EnabledOAuthProviders() []string

EnabledOAuthProviders returns the list of provider IDs that are configured and enabled.

func (*Config) IsGitHubOAuthEnabled

func (c *Config) IsGitHubOAuthEnabled() bool

IsGitHubOAuthEnabled returns true if GitHub OAuth is configured (for backward compatibility with frontend).

func (*Config) OAuthProvider

func (c *Config) OAuthProvider(providerID string) *OAuthProviderConfig

OAuthProvider returns the config for a provider ID, or nil if not configured.

type OAuthConfig

type OAuthConfig struct {
	Providers map[string]OAuthProviderConfig
}

OAuthConfig holds per-provider OAuth settings.

type OAuthProviderConfig

type OAuthProviderConfig struct {
	ClientID     string
	ClientSecret string // #nosec G117 -- OAuth client secret from config, not logged
	Scopes       []string
}

OAuthProviderConfig is the config for one OAuth provider (e.g. GitHub).

Jump to

Keyboard shortcuts

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