goshort/internal/service/config/configservice.go
Gustavo Maronato 4fef573447
Some checks failed
Check / checks (push) Failing after 4m11s
added frontend oidc support
2024-03-09 05:42:36 -05:00

37 lines
1.2 KiB
Go

package configservice
import "git.maronato.dev/maronato/goshort/internal/config"
type PublicConfig struct {
// DisableRegistration defines whether or not registration are disabled.
DisableRegistration bool `json:"disableRegistration"`
// DisableCredentialsLogin defines whether or not the server should disable credential login.
DisableCredentialsLogin bool `json:"disableCredentialLogin"`
// OIDCIssuerURL is the URL of the OIDC issuer.
OIDCIssuerURL string `json:"oidcIssuerUrl"`
// OIDCIssuerName is the name of the OIDC issuer.
OIDCIssuerName string `json:"oidcIssuerName"`
}
// ConfigService is the service that handles the configuration.
type ConfigService struct {
cfg *config.Config
}
// NewConfigService creates a new configuration service.
func NewConfigService(cfg *config.Config) *ConfigService {
return &ConfigService{
cfg: cfg,
}
}
// GetPublicConfigJSON returns the public configuration as a JSON string.
func (s *ConfigService) GetPublicConfig() *PublicConfig {
return &PublicConfig{
DisableRegistration: s.cfg.DisableRegistration,
DisableCredentialsLogin: s.cfg.DisableCredentialsLogin,
OIDCIssuerURL: s.cfg.OIDCIssuerURL,
OIDCIssuerName: s.cfg.OIDCIssuerName,
}
}