HH-553: remove deprecated CORS env references (#130)
Co-authored-by: Rogee <rogee@ipao.vip>
This commit is contained in:
@@ -413,7 +413,6 @@ jobs:
|
||||
env:
|
||||
GOCHAT_IMAGE_REF: gochat:production-smoke
|
||||
GOCHAT_PORT: "38080"
|
||||
GOCHAT_SERVER_CORS_ALLOWED_ORIGINS: https://chat.ci.rogeecn.com
|
||||
GOCHAT_DATABASE_DSN: "postgres://gochat:ci-postgres-secret@db.smoke.test:5432/gochat_production?sslmode=verify-full&sslrootcert=/run/secrets/external-db-ca.crt&sslcert=/run/secrets/external-db-client.crt&sslkey=/run/secrets/external-db-client.key"
|
||||
GOCHAT_DATABASE_TLS_CA_FILE: ${{ github.workspace }}/.tmp/gochat-tls/ca.crt
|
||||
GOCHAT_DATABASE_TLS_CLIENT_CERT_FILE: ${{ github.workspace }}/.tmp/gochat-tls/postgres.crt
|
||||
|
||||
@@ -539,7 +539,6 @@ func LoadWithEnv(env string) (*Config, error) {
|
||||
"GOCHAT_SERVER_SHUTDOWN_TIMEOUT_SECONDS": "server.shutdown_timeout_seconds",
|
||||
"GOCHAT_SERVER_MAX_HEADER_BYTES": "server.max_header_bytes",
|
||||
"GOCHAT_SERVER_TRUSTED_PROXIES": "server.trusted_proxies",
|
||||
"GOCHAT_SERVER_CORS_ALLOWED_ORIGINS": "server.cors.allowed_origins",
|
||||
"GOCHAT_DATABASE_DSN": "database.dsn",
|
||||
"GOCHAT_DATABASE_MAX_IDLE_CONNS": "database.max_idle_conns",
|
||||
"GOCHAT_DATABASE_MAX_OPEN_CONNS": "database.max_open_conns",
|
||||
|
||||
@@ -353,7 +353,6 @@ func TestLoadWithEnv_ProductionOverlay(t *testing.T) {
|
||||
t.Setenv("GOCHAT_REDIS_DSN", "rediss://:redis-secret@redis.acme.test:6379")
|
||||
t.Setenv("GOCHAT_JWT_SECRET", "production-jwt-secret-at-least-32-characters")
|
||||
t.Setenv("GOCHAT_SEARCH_API_KEY", "search-secret-123")
|
||||
t.Setenv("GOCHAT_SERVER_CORS_ALLOWED_ORIGINS", "https://chat.acme.test")
|
||||
t.Setenv("GOCHAT_ENCRYPTION_ENABLED", "true")
|
||||
t.Setenv("GOCHAT_ENCRYPTION_CURRENT_KEY_VERSION", "1")
|
||||
t.Setenv("GOCHAT_ENCRYPTION_AES_KEY", "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=")
|
||||
@@ -362,7 +361,6 @@ func TestLoadWithEnv_ProductionOverlay(t *testing.T) {
|
||||
cfg, err := LoadWithEnv("production")
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, "release", cfg.Server.Mode)
|
||||
assert.Equal(t, []string{"https://chat.acme.test"}, cfg.Server.CORS.AllowedOrigins)
|
||||
assert.NoError(t, Validate(cfg))
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,6 @@ func TestSecuritySettingsLoadFromEnvironment(t *testing.T) {
|
||||
require.NoError(t, os.Chdir(filepath.Join(workingDir, "..", "..")))
|
||||
t.Cleanup(func() { _ = os.Chdir(workingDir) })
|
||||
t.Setenv("GOCHAT_SERVER_TRUSTED_PROXIES", "10.0.0.0/8,192.0.2.10")
|
||||
t.Setenv("GOCHAT_SERVER_CORS_ALLOWED_ORIGINS", "https://chat.acme.test,https://admin.acme.test")
|
||||
t.Setenv("GOCHAT_JWT_WS_TICKET_TTL_SECONDS", "20")
|
||||
t.Setenv("GOCHAT_ENCRYPTION_ENABLED", "true")
|
||||
t.Setenv("GOCHAT_RATE_LIMIT_LOGIN_REQUESTS", "7")
|
||||
@@ -67,7 +66,6 @@ func TestSecuritySettingsLoadFromEnvironment(t *testing.T) {
|
||||
cfg, err := LoadWithEnv("default")
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, []string{"10.0.0.0/8", "192.0.2.10"}, cfg.Server.TrustedProxies)
|
||||
require.Equal(t, []string{"https://chat.acme.test", "https://admin.acme.test"}, cfg.Server.CORS.AllowedOrigins)
|
||||
require.Equal(t, 20, cfg.JWT.WSTicketTTLSeconds)
|
||||
require.True(t, cfg.Encryption.Enabled)
|
||||
require.Equal(t, 7, cfg.RateLimit.Login.Requests)
|
||||
|
||||
@@ -65,7 +65,6 @@ production_env=(
|
||||
-e GOCHAT_REDIS_DSN=redis://:test-password@redis:6379
|
||||
-e GOCHAT_JWT_SECRET=ci-smoke-jwt-secret-at-least-32-characters
|
||||
-e GOCHAT_SEARCH_API_KEY=ci-meili-secret-16
|
||||
-e GOCHAT_SERVER_CORS_ALLOWED_ORIGINS=https://chat.example.test
|
||||
)
|
||||
for command in serve worker; do
|
||||
if docker run --rm "${production_env[@]}" --entrypoint /app/gochat "$gochat_image" "$command" >"$tmp/direct-$command.log" 2>&1; then
|
||||
|
||||
@@ -13,7 +13,6 @@ chmod 0640 "$tmp/external-db-client.key"
|
||||
|
||||
export GOCHAT_IMAGE_REF='gochat.example.test/gochat@sha256:0000000000000000000000000000000000000000000000000000000000000000'
|
||||
export SHANGWUTONG_IMAGE_REF='gochat.example.test/shangwutong@sha256:1111111111111111111111111111111111111111111111111111111111111111'
|
||||
export GOCHAT_SERVER_CORS_ALLOWED_ORIGINS=https://chat.example.test
|
||||
export GOCHAT_REDIS_DSN='rediss://:ci-redis-secret@redis.example.test:6379/0'
|
||||
export GOCHAT_ENCRYPTION_AES_KEY=MDEyMzQ1Njc4OWFiY2RlZjAxMjM0NTY3ODlhYmNkZWY=
|
||||
export POSTGRES_PASSWORD=ci-postgres-secret
|
||||
|
||||
@@ -37,7 +37,6 @@ chmod +x "$tmp/bin/findmnt" "$tmp/bin/docker"
|
||||
export PATH="$tmp/bin:$PATH"
|
||||
export GOCHAT_IMAGE_REF='gochat@example.invalid/gochat@sha256:0000000000000000000000000000000000000000000000000000000000000000'
|
||||
export SHANGWUTONG_IMAGE_REF='gochat@example.invalid/connector@sha256:1111111111111111111111111111111111111111111111111111111111111111'
|
||||
unset GOCHAT_SERVER_CORS_ALLOWED_ORIGINS
|
||||
export GOCHAT_DATABASE_DSN='postgres://external_user:external_password@db.example.test:5432/gochat?sslmode=verify-full'
|
||||
export GOCHAT_REDIS_DSN='rediss://:ci-redis-secret@redis.example.test:6379/0'
|
||||
export POSTGRES_PASSWORD=ci-postgres-secret
|
||||
|
||||
Reference in New Issue
Block a user