Remove useless comment
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
@@ -23,19 +23,14 @@ import (
|
|||||||
"go.probo.inc/probo/pkg/probod"
|
"go.probo.inc/probo/pkg/probod"
|
||||||
)
|
)
|
||||||
|
|
||||||
// EnvGetter is a function that retrieves environment variables.
|
|
||||||
// This allows for easy testing by injecting a mock implementation.
|
|
||||||
type EnvGetter func(key string) string
|
type EnvGetter func(key string) string
|
||||||
|
|
||||||
// Builder creates a Config from environment variables.
|
|
||||||
type Builder struct {
|
type Builder struct {
|
||||||
getEnv EnvGetter
|
getEnv EnvGetter
|
||||||
samlCertificate string
|
samlCertificate string
|
||||||
samlPrivateKey string
|
samlPrivateKey string
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewBuilder creates a new Builder with the given environment getter.
|
|
||||||
// If getEnv is nil, os.Getenv is used.
|
|
||||||
func NewBuilder(getEnv EnvGetter) *Builder {
|
func NewBuilder(getEnv EnvGetter) *Builder {
|
||||||
if getEnv == nil {
|
if getEnv == nil {
|
||||||
getEnv = os.Getenv
|
getEnv = os.Getenv
|
||||||
@@ -43,15 +38,11 @@ func NewBuilder(getEnv EnvGetter) *Builder {
|
|||||||
return &Builder{getEnv: getEnv}
|
return &Builder{getEnv: getEnv}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetSAMLCredentials sets pre-generated SAML certificate and private key.
|
|
||||||
// If not set, they will be generated automatically if not provided via environment.
|
|
||||||
func (b *Builder) SetSAMLCredentials(certificate, privateKey string) {
|
func (b *Builder) SetSAMLCredentials(certificate, privateKey string) {
|
||||||
b.samlCertificate = certificate
|
b.samlCertificate = certificate
|
||||||
b.samlPrivateKey = privateKey
|
b.samlPrivateKey = privateKey
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build creates a FullConfig from environment variables.
|
|
||||||
// Returns an error if required environment variables are missing.
|
|
||||||
func (b *Builder) Build() (*probod.FullConfig, error) {
|
func (b *Builder) Build() (*probod.FullConfig, error) {
|
||||||
if err := b.validateRequired(); err != nil {
|
if err := b.validateRequired(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
@@ -23,8 +23,6 @@ import (
|
|||||||
"gopkg.in/yaml.v3"
|
"gopkg.in/yaml.v3"
|
||||||
)
|
)
|
||||||
|
|
||||||
// WriteConfig writes the configuration to the specified path as YAML.
|
|
||||||
// It creates the parent directory if it doesn't exist.
|
|
||||||
func WriteConfig(cfg *probod.FullConfig, path string) error {
|
func WriteConfig(cfg *probod.FullConfig, path string) error {
|
||||||
dir := filepath.Dir(path)
|
dir := filepath.Dir(path)
|
||||||
if err := os.MkdirAll(dir, 0755); err != nil {
|
if err := os.MkdirAll(dir, 0755); err != nil {
|
||||||
|
|||||||
@@ -14,17 +14,14 @@
|
|||||||
|
|
||||||
package probod
|
package probod
|
||||||
|
|
||||||
// CorsConfig contains CORS settings.
|
|
||||||
type CorsConfig struct {
|
type CorsConfig struct {
|
||||||
AllowedOrigins []string `json:"allowed-origins"`
|
AllowedOrigins []string `json:"allowed-origins"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ProxyProtocolConfig contains proxy protocol settings.
|
|
||||||
type ProxyProtocolConfig struct {
|
type ProxyProtocolConfig struct {
|
||||||
TrustedProxies []string `json:"trusted-proxies"`
|
TrustedProxies []string `json:"trusted-proxies"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// APIConfig contains HTTP API configuration.
|
|
||||||
type APIConfig struct {
|
type APIConfig struct {
|
||||||
Addr string `json:"addr"`
|
Addr string `json:"addr"`
|
||||||
ProxyProtocol ProxyProtocolConfig `json:"proxy-protocol"`
|
ProxyProtocol ProxyProtocolConfig `json:"proxy-protocol"`
|
||||||
|
|||||||
@@ -19,9 +19,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
)
|
)
|
||||||
|
|
||||||
// AuthConfig contains authentication configuration.
|
|
||||||
type AuthConfig struct {
|
type AuthConfig struct {
|
||||||
Cookie CookieConfig `json:"cookie"`
|
Cookie CookieConfig `json:"cookie"`
|
||||||
Password PasswordConfig `json:"password"`
|
Password PasswordConfig `json:"password"`
|
||||||
DisableSignup bool `json:"disable-signup"`
|
DisableSignup bool `json:"disable-signup"`
|
||||||
InvitationConfirmationTokenValidity int `json:"invitation-confirmation-token-validity"`
|
InvitationConfirmationTokenValidity int `json:"invitation-confirmation-token-validity"`
|
||||||
@@ -30,7 +29,6 @@ type AuthConfig struct {
|
|||||||
SAML SAMLConfig `json:"saml"`
|
SAML SAMLConfig `json:"saml"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// CookieConfig contains session cookie configuration.
|
|
||||||
type CookieConfig struct {
|
type CookieConfig struct {
|
||||||
Domain string `json:"domain"`
|
Domain string `json:"domain"`
|
||||||
Secret string `json:"secret"`
|
Secret string `json:"secret"`
|
||||||
@@ -39,7 +37,6 @@ type CookieConfig struct {
|
|||||||
Secure bool `json:"secure"`
|
Secure bool `json:"secure"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// PasswordConfig contains password hashing configuration.
|
|
||||||
type PasswordConfig struct {
|
type PasswordConfig struct {
|
||||||
Iterations int `json:"iterations"`
|
Iterations int `json:"iterations"`
|
||||||
Pepper string `json:"pepper"`
|
Pepper string `json:"pepper"`
|
||||||
|
|||||||
@@ -14,7 +14,6 @@
|
|||||||
|
|
||||||
package probod
|
package probod
|
||||||
|
|
||||||
// AWSConfig contains AWS S3 configuration.
|
|
||||||
type AWSConfig struct {
|
type AWSConfig struct {
|
||||||
Region string `json:"region"`
|
Region string `json:"region"`
|
||||||
Bucket string `json:"bucket"`
|
Bucket string `json:"bucket"`
|
||||||
|
|||||||
@@ -23,17 +23,15 @@ import (
|
|||||||
"go.probo.inc/probo/pkg/connector"
|
"go.probo.inc/probo/pkg/connector"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ConnectorConfig contains connector configuration.
|
|
||||||
type ConnectorConfig struct {
|
type ConnectorConfig struct {
|
||||||
Provider string `json:"provider"`
|
Provider string `json:"provider"`
|
||||||
Protocol connector.ProtocolType `json:"protocol"`
|
Protocol connector.ProtocolType `json:"protocol"`
|
||||||
Config connector.Connector `json:"-"`
|
Config connector.Connector `json:"-"`
|
||||||
RawConfig any `json:"config,omitempty"`
|
RawConfig any `json:"config,omitempty"`
|
||||||
Settings any `json:"-"`
|
Settings any `json:"-"`
|
||||||
RawSettings any `json:"settings,omitempty"`
|
RawSettings any `json:"settings,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ConnectorConfigOAuth2 contains OAuth2 connector configuration.
|
|
||||||
type ConnectorConfigOAuth2 struct {
|
type ConnectorConfigOAuth2 struct {
|
||||||
ClientID string `json:"client-id"`
|
ClientID string `json:"client-id"`
|
||||||
ClientSecret string `json:"client-secret"`
|
ClientSecret string `json:"client-secret"`
|
||||||
|
|||||||
@@ -14,7 +14,6 @@
|
|||||||
|
|
||||||
package probod
|
package probod
|
||||||
|
|
||||||
// CustomDomainsConfig contains custom domain configuration.
|
|
||||||
type CustomDomainsConfig struct {
|
type CustomDomainsConfig struct {
|
||||||
RenewalInterval int `json:"renewal-interval"`
|
RenewalInterval int `json:"renewal-interval"`
|
||||||
ProvisionInterval int `json:"provision-interval"`
|
ProvisionInterval int `json:"provision-interval"`
|
||||||
@@ -23,7 +22,6 @@ type CustomDomainsConfig struct {
|
|||||||
ACME ACMEConfig `json:"acme"`
|
ACME ACMEConfig `json:"acme"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ACMEConfig contains ACME certificate configuration.
|
|
||||||
type ACMEConfig struct {
|
type ACMEConfig struct {
|
||||||
Directory string `json:"directory"`
|
Directory string `json:"directory"`
|
||||||
Email string `json:"email"`
|
Email string `json:"email"`
|
||||||
|
|||||||
@@ -14,7 +14,6 @@
|
|||||||
|
|
||||||
package probod
|
package probod
|
||||||
|
|
||||||
// MailerConfig contains email mailer configuration.
|
|
||||||
type MailerConfig struct {
|
type MailerConfig struct {
|
||||||
MailerInterval int `json:"mailer-interval"`
|
MailerInterval int `json:"mailer-interval"`
|
||||||
SenderName string `json:"sender-name"`
|
SenderName string `json:"sender-name"`
|
||||||
@@ -22,7 +21,6 @@ type MailerConfig struct {
|
|||||||
SMTP SMTPConfig `json:"smtp"`
|
SMTP SMTPConfig `json:"smtp"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// SMTPConfig contains SMTP server configuration.
|
|
||||||
type SMTPConfig struct {
|
type SMTPConfig struct {
|
||||||
Addr string `json:"addr"`
|
Addr string `json:"addr"`
|
||||||
User string `json:"user"`
|
User string `json:"user"`
|
||||||
|
|||||||
@@ -14,14 +14,12 @@
|
|||||||
|
|
||||||
package probod
|
package probod
|
||||||
|
|
||||||
// NotificationsConfig contains notification configuration.
|
|
||||||
type NotificationsConfig struct {
|
type NotificationsConfig struct {
|
||||||
Mailer MailerConfig `json:"mailer"`
|
Mailer MailerConfig `json:"mailer"`
|
||||||
Slack SlackConfig `json:"slack"`
|
Slack SlackConfig `json:"slack"`
|
||||||
Webhook WebhookConfig `json:"webhook"`
|
Webhook WebhookConfig `json:"webhook"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// WebhookConfig contains webhook configuration.
|
|
||||||
type WebhookConfig struct {
|
type WebhookConfig struct {
|
||||||
SenderInterval int `json:"sender-interval"`
|
SenderInterval int `json:"sender-interval"`
|
||||||
CacheTTL int `json:"cache-ttl"`
|
CacheTTL int `json:"cache-ttl"`
|
||||||
|
|||||||
@@ -14,7 +14,6 @@
|
|||||||
|
|
||||||
package probod
|
package probod
|
||||||
|
|
||||||
// OpenAIConfig contains OpenAI API configuration.
|
|
||||||
type OpenAIConfig struct {
|
type OpenAIConfig struct {
|
||||||
APIKey string `json:"api-key"`
|
APIKey string `json:"api-key"`
|
||||||
Temperature float64 `json:"temperature"`
|
Temperature float64 `json:"temperature"`
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ import (
|
|||||||
"go.gearno.de/kit/pg"
|
"go.gearno.de/kit/pg"
|
||||||
)
|
)
|
||||||
|
|
||||||
// PgConfig contains PostgreSQL database configuration.
|
|
||||||
type PgConfig struct {
|
type PgConfig struct {
|
||||||
Addr string `json:"addr"`
|
Addr string `json:"addr"`
|
||||||
Username string `json:"username"`
|
Username string `json:"username"`
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SAMLConfig contains SAML authentication configuration.
|
|
||||||
type SAMLConfig struct {
|
type SAMLConfig struct {
|
||||||
SessionDuration int `json:"session-duration"`
|
SessionDuration int `json:"session-duration"`
|
||||||
CleanupIntervalSeconds int `json:"cleanup-interval-seconds"`
|
CleanupIntervalSeconds int `json:"cleanup-interval-seconds"`
|
||||||
|
|||||||
@@ -14,13 +14,7 @@
|
|||||||
|
|
||||||
package probod
|
package probod
|
||||||
|
|
||||||
// SCIMBridgeConfig contains SCIM bridge configuration.
|
|
||||||
type SCIMBridgeConfig struct {
|
type SCIMBridgeConfig struct {
|
||||||
// SyncInterval is the time between sync attempts for each bridge (in seconds).
|
|
||||||
// Default: 900 (15 minutes)
|
|
||||||
SyncInterval int `json:"sync-interval"`
|
SyncInterval int `json:"sync-interval"`
|
||||||
|
|
||||||
// PollInterval is the time between polling for bridges to sync (in seconds).
|
|
||||||
// Default: 30
|
|
||||||
PollInterval int `json:"poll-interval"`
|
PollInterval int `json:"poll-interval"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,6 @@
|
|||||||
|
|
||||||
package probod
|
package probod
|
||||||
|
|
||||||
// SlackConfig contains Slack notification configuration.
|
|
||||||
type SlackConfig struct {
|
type SlackConfig struct {
|
||||||
SenderInterval int `json:"sender-interval"`
|
SenderInterval int `json:"sender-interval"`
|
||||||
SigningSecret string `json:"signing-secret"`
|
SigningSecret string `json:"signing-secret"`
|
||||||
|
|||||||
Reference in New Issue
Block a user