@@ -42,6 +42,8 @@ type Config struct {
4242 Plugins []string `comment:"Ordered list of plugins (default: [])"`
4343 ReadTimeout int64 `comment:"The maximum duration (seconds) for reading the entire request, including the body (default: 60)"`
4444 WriteTimeout int64 `comment:"The maximum duration before timing out writes of the response (default: 60)"`
45+ TokenExpiry int64 `comment:"JWT token expiry in seconds (default: 86400 = 24h, 0 for no expiry)"`
46+ VerboseErrors bool `comment:"Return full database error details (hint, detail) to clients (default: true)"`
4547 RequestMaxBytes int64 `comment:"Max bytes allowed in requests, to limit the size of incoming request bodies (default: 1M, 0 for unlimited)"`
4648 Database database.Config `comment:"Database configuration"`
4749 Logging logging.Config `comment:"Logging configuration"`
@@ -63,13 +65,15 @@ func defaultConfig() *Config {
6365 BaseAPIURL : "/api" ,
6466 ShortAPIURL : false ,
6567 BaseAdminURL : "/admin" ,
66- CORSAllowedOrigins : []string {"*" },
68+ CORSAllowedOrigins : []string {},
6769 CORSAllowCredentials : false ,
6870 EnableDebugRoute : false ,
6971 PluginDir : "./_plugins" ,
7072 Plugins : []string {},
7173 ReadTimeout : 60 ,
7274 WriteTimeout : 60 ,
75+ TokenExpiry : 86400 ,
76+ VerboseErrors : true ,
7377 RequestMaxBytes : 1024 * 1024 ,
7478 Database : * database .DefaultConfig (),
7579 Logging : * logging .DefaultConfig (),
@@ -226,6 +230,19 @@ func checkConfig(cfg *Config) error {
226230 fmt .Println ("Warning: 'ShortAPIURL' requires a single db in 'Database.AllowedDatabases'" )
227231 cfg .ShortAPIURL = false
228232 }
233+ if cfg .LoginMode != "none" && cfg .JWTSecret == "" {
234+ fmt .Println ("Warning: 'JWTSecret' is empty while authentication is enabled (LoginMode:" , cfg .LoginMode + ")" )
235+ }
236+ if cfg .CORSAllowCredentials {
237+ for _ , origin := range cfg .CORSAllowedOrigins {
238+ if origin == "*" {
239+ return fmt .Errorf ("invalid CORS configuration: 'CORSAllowCredentials' cannot be true when 'CORSAllowedOrigins' includes '*'" )
240+ }
241+ }
242+ }
243+ if cfg .RequestMaxBytes == 0 {
244+ fmt .Println ("Warning: 'RequestMaxBytes' is 0 (unlimited request body size)" )
245+ }
229246 canContinue , err := database .CheckDatabase (& cfg .Database )
230247 if err != nil {
231248 return err
0 commit comments