Files
geo/server/internal/shared/bootstrap/http.go
T
root 7d8e82c69f feat(ops): add object storage management and site-mapping CSV import/export
Ship the Ops backstage 对象存储 page (browse / upload / move / delete /
folder ops) backed by a new object-storage service + handler, with the
shared storage client extended with List/Stat/Copy/Usage/DownloadURL so
both MinIO and Aliyun providers cover the new surface. Add
ForcePathStyle to the object-storage config and treat r2/s3/custom_s3
as external providers so Cloudflare R2 and other S3-compatibles can
share the MinIO client path without spinning up the bundled MinIO.

Also add CSV import/export + template download to the site-domain
mappings page, raise gin MaxMultipartMemory to 8 MiB for the new
multipart endpoints, register Ops swagger routes, and extend the
descriptions-parity test to cover the ops router.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-26 01:19:01 +08:00

27 lines
661 B
Go

package bootstrap
import (
"fmt"
"github.com/gin-gonic/gin"
"github.com/geo-platform/tenant-api/internal/shared/config"
)
const MaxMultipartMemory = 8 << 20
func NewEngine(server config.ServerConfig) (*gin.Engine, error) {
config.NormalizeServerConfig(&server)
if server.Mode == "release" {
gin.SetMode(gin.ReleaseMode)
}
engine := gin.New()
engine.MaxMultipartMemory = MaxMultipartMemory
engine.ForwardedByClientIP = true
engine.RemoteIPHeaders = []string{"X-Forwarded-For", "X-Real-IP"}
if err := engine.SetTrustedProxies(server.TrustedProxies); err != nil {
return nil, fmt.Errorf("set trusted proxies: %w", err)
}
return engine, nil
}