Documentation
¶
Index ¶
Constants ¶
const ( // AuthModeOIDC 는 IdP 가 서명한 JWT 를 실제로 검증한다. AuthModeOIDC = "oidc" // AuthModeSession 은 알파 시절의 단순화된 방식으로, 클라이언트가 보낸 // X-User-* 헤더를 그대로 신뢰한다 — 검증이 아니다. AuthModeSession = "session" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthConfig ¶
type AuthConfig struct {
Mode string `mapstructure:"mode"`
Session SessionConfig `mapstructure:"session"`
OIDC OIDCConfig `mapstructure:"oidc"`
}
AuthConfig holds authentication configuration.
type Config ¶
type Config struct {
Server ServerConfig `mapstructure:"server"`
Database DatabaseConfig `mapstructure:"database"`
Auth AuthConfig `mapstructure:"auth"`
Keycloak KeycloakConfig `mapstructure:"keycloak"`
Helm HelmConfig `mapstructure:"helm"`
Prometheus PrometheusConfig `mapstructure:"prometheus"`
Log LogConfig `mapstructure:"log"`
Platform PlatformConfig `mapstructure:"platform"`
}
func LoadConfig ¶
LoadConfig reads configuration from the given file path and environment variables.
func (Config) KeycloakAdmin ¶
func (c Config) KeycloakAdmin() (KeycloakConfig, bool)
KeycloakAdmin 은 OSS SSO 프로비저닝(provisioning_sso)에 쓸 Keycloak 관리자 접속 정보를 정규화해 돌려준다.
ok=false 는 "이 설치에서는 SSO 프로비저닝을 하지 않는다" 는 뜻이다 — BYO IdP 나 SSO 미사용 구성이 여기에 해당한다. 주소가 없는 것을 에러로 만들면 Keycloak 없이 쓰는 설치가 기동조차 못 하므로 구분한다.
func (Config) SessionTTL ¶
SessionTTL 은 ID/PW 로그인이 발급하는 세션 토큰의 수명이다.
max_age 가 0 이면 발급 즉시 만료된 토큰이 나온다 — 로그인은 성공하는데 다음 요청이 401 이라 원인을 찾기 어렵다. 그래서 0 이하는 기본값으로 물러난다.
func (Config) ToolOIDCIssuerURL ¶
ToolOIDCIssuerURL 은 설치되는 OSS 가 쓸 Keycloak issuer 를 돌려준다.
도구는 브라우저를 이 주소로 보낸다. 포털이 로그인한 Keycloak 과 **오리진이 같아야** SSO 세션 쿠키가 실려 재인증 없이 넘어간다 — 같은 인스턴스라도 호스트가 다르면 쿠키가 안 실린다.
그래서 기본값은 포털(API)이 쓰는 auth.oidc.issuer_url 을 그대로 물려받는다. 예전에는 이 값을 스택의 access_domain 에서 "keycloak.<도메인>" 으로 만들어 냈는데, 플랫폼 Keycloak 은 스택마다가 아니라 하나뿐이라 스택이 둘 이상이면 반드시 어긋났고, auth.nullus.io 처럼 접두사가 다른 배포는 아예 표현할 수 없었다.
func (Config) TrustsClientSuppliedIdentity ¶
TrustsClientSuppliedIdentity reports whether the running config lets callers assert their own identity.
session 모드는 X-User-ID / X-User-Role 헤더를 그대로 믿는다. 즉 누구나 관리자를 자칭할 수 있다. development 는 인증을 끄는 것이 의도된 동작이라 제외한다 — 여기서 참을 돌려주는 경우는 "운영처럼 돌리는데 사실 무인증" 인 상황뿐이다.
func (Config) ValidateAuth ¶
ValidateAuth rejects auth settings that cannot work at runtime.
development 모드는 인증 미들웨어를 붙이지 않으므로 검사에서 제외한다. 그 밖의 모드에서 oidc 를 골랐는데 issuer 가 비어 있으면 JWKS 를 못 받아 **모든 요청이 401** 이 된다. 그 상태로 기동시키면 원인 찾기 어려운 장애가 되므로 기동 시점에 끊는다.
func (Config) ValidateKeycloakAdmin ¶
ValidateKeycloakAdmin 은 런타임에만 드러날 프로비저닝 설정 오류를 기동 시점에 끊는다.
주소만 있고 비밀번호가 없으면 admin-cli 토큰 발급이 실패하는데, 그 실패는 스택 설치가 provisioning_sso 단계까지 간 뒤에야 보인다. 설치를 몇 분 진행한 다음 깨지는 대신 여기서 멈춘다.
type DatabaseConfig ¶
type DatabaseConfig struct {
Host string `mapstructure:"host"`
Port int `mapstructure:"port"`
Name string `mapstructure:"name"`
User string `mapstructure:"user"`
Password string `mapstructure:"password"`
SSLMode string `mapstructure:"sslmode"`
MaxOpenConns int `mapstructure:"max_open_conns"`
MaxIdleConns int `mapstructure:"max_idle_conns"`
ConnMaxLifetime time.Duration `mapstructure:"conn_max_lifetime"`
ConnMaxIdleTime time.Duration `mapstructure:"conn_max_idle_time"`
}
DatabaseConfig holds database connection configuration.
type HelmConfig ¶
type KeycloakConfig ¶
type KeycloakConfig struct {
AdminURL string `mapstructure:"admin_url"`
// PublicURL 은 브라우저가 접근하는 Keycloak 주소다. AdminURL 이 클러스터 내부
// 주소일 수 있어 따로 둔다. 비우면 auth.oidc.issuer_url 을 물려받는다.
PublicURL string `mapstructure:"public_url"`
Realm string `mapstructure:"realm"`
AdminUser string `mapstructure:"admin_user"`
AdminPassword string `mapstructure:"admin_password"`
}
type OIDCConfig ¶
type PlatformConfig ¶
type PlatformConfig struct {
Namespace string `mapstructure:"namespace"`
}
PlatformConfig 는 플랫폼 자신이 어디에 떠 있는지를 담는다.
스택을 플랫폼과 같은 네임스페이스에 설치하면 Helm 소유권이 충돌하고, 스택을 지울 때 플랫폼 리소스까지 지워진다 — 2026-08-20 에 실제로 그렇게 nullus.io 가 통째로 내려갔다. 자기 자리를 알아야 그 자리를 지킬 수 있다.
차트가 Downward API 로 NULLUS_PLATFORM_NAMESPACE 를 넣어 준다. 클러스터 밖에서 도는 개발 환경에서는 비어 있고, 그때는 이 검사를 하지 않는다.
type PrometheusConfig ¶
type PrometheusConfig struct {
URL string `mapstructure:"url"`
}
type ServerConfig ¶
ServerConfig holds HTTP server configuration.
type SessionConfig ¶
type SessionConfig struct {
Secret string `mapstructure:"secret"`
MaxAge int `mapstructure:"max_age"`
}
SessionConfig holds session-based auth configuration.