Skip to content

Commit bc36343

Browse files
committed
move the request_id_header option to the server section and the enable_two_factor option to the user section
1 parent 979b16d commit bc36343

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

conf/ezbookkeeping.ini

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ enable_gzip = false
3737
# Set to true to log each request and execution time
3838
log_request = true
3939

40+
# Add X-Request-Id header to response to track user request or error, default is true
41+
request_id_header = true
42+
4043
[mcp]
4144
# Set to true to enable MCP (Model Context Protocol) server (via http / https web server) for AI/LLM access
4245
enable_mcp = false
@@ -190,9 +193,6 @@ enable_create_scheduled_transaction = true
190193
# Used for signing, you must change it to keep your user data safe before you first run ezBookkeeping
191194
secret_key =
192195

193-
# Set to true to enable two-factor authorization
194-
enable_two_factor = true
195-
196196
# Token expired seconds (60 - 4294967295), default is 2592000 (30 days)
197197
token_expired_time = 2592000
198198

@@ -215,9 +215,6 @@ max_failures_per_ip_per_minute = 5
215215
# Maximum count of password / token check failures (0 - 4294967295) per user per minute (use the above duplicate checker), default is 5, set to 0 to disable
216216
max_failures_per_user_per_minute = 5
217217

218-
# Add X-Request-Id header to response to track user request or error, default is true
219-
request_id_header = true
220-
221218
[user]
222219
# Set to true to allow users to register account by themselves
223220
enable_register = true
@@ -234,6 +231,9 @@ enable_forget_password = true
234231
# Set to true to require email must be verified when use forget password
235232
forget_password_require_email_verify = false
236233

234+
# Set to true to enable two-factor authorization
235+
enable_two_factor = true
236+
237237
# Set to true to allow users to upload transaction pictures
238238
enable_transaction_picture = true
239239

pkg/settings/setting.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,9 @@ type Config struct {
245245

246246
StaticRootPath string
247247

248-
EnableGZip bool
249-
EnableRequestLog bool
248+
EnableGZip bool
249+
EnableRequestLog bool
250+
EnableRequestIdHeader bool
250251

251252
// MCP
252253
EnableMCPServer bool
@@ -299,7 +300,6 @@ type Config struct {
299300
// Secret
300301
SecretKeyNoSet bool
301302
SecretKey string
302-
EnableTwoFactor bool
303303
TokenExpiredTime uint32
304304
TokenExpiredTimeDuration time.Duration
305305
TokenMinRefreshInterval uint32
@@ -311,14 +311,14 @@ type Config struct {
311311
PasswordResetTokenExpiredTimeDuration time.Duration
312312
MaxFailuresPerIpPerMinute uint32
313313
MaxFailuresPerUserPerMinute uint32
314-
EnableRequestIdHeader bool
315314

316315
// User
317316
EnableUserRegister bool
318317
EnableUserVerifyEmail bool
319318
EnableUserForceVerifyEmail bool
320319
EnableUserForgetPassword bool
321320
ForgetPasswordRequireVerifyEmail bool
321+
EnableTwoFactor bool
322322
EnableTransactionPictures bool
323323
MaxTransactionPictureFileSize uint32
324324
EnableScheduledTransaction bool
@@ -561,6 +561,7 @@ func loadServerConfiguration(config *Config, configFile *ini.File, sectionName s
561561

562562
config.EnableGZip = getConfigItemBoolValue(configFile, sectionName, "enable_gzip", false)
563563
config.EnableRequestLog = getConfigItemBoolValue(configFile, sectionName, "log_request", false)
564+
config.EnableRequestIdHeader = getConfigItemBoolValue(configFile, sectionName, "request_id_header", true)
564565

565566
return nil
566567
}
@@ -801,7 +802,6 @@ func loadCronConfiguration(config *Config, configFile *ini.File, sectionName str
801802
func loadSecurityConfiguration(config *Config, configFile *ini.File, sectionName string) error {
802803
config.SecretKeyNoSet = !getConfigItemIsSet(configFile, sectionName, "secret_key")
803804
config.SecretKey = getConfigItemStringValue(configFile, sectionName, "secret_key", defaultSecretKey)
804-
config.EnableTwoFactor = getConfigItemBoolValue(configFile, sectionName, "enable_two_factor", true)
805805

806806
config.TokenExpiredTime = getConfigItemUint32Value(configFile, sectionName, "token_expired_time", defaultTokenExpiredTime)
807807

@@ -844,8 +844,6 @@ func loadSecurityConfiguration(config *Config, configFile *ini.File, sectionName
844844
config.MaxFailuresPerIpPerMinute = getConfigItemUint32Value(configFile, sectionName, "max_failures_per_ip_per_minute", defaultMaxFailuresPerIpPerMinute)
845845
config.MaxFailuresPerUserPerMinute = getConfigItemUint32Value(configFile, sectionName, "max_failures_per_user_per_minute", defaultMaxFailuresPerUserPerMinute)
846846

847-
config.EnableRequestIdHeader = getConfigItemBoolValue(configFile, sectionName, "request_id_header", true)
848-
849847
return nil
850848
}
851849

@@ -855,6 +853,7 @@ func loadUserConfiguration(config *Config, configFile *ini.File, sectionName str
855853
config.EnableUserForceVerifyEmail = getConfigItemBoolValue(configFile, sectionName, "enable_force_email_verify", false)
856854
config.EnableUserForgetPassword = getConfigItemBoolValue(configFile, sectionName, "enable_forget_password", false)
857855
config.ForgetPasswordRequireVerifyEmail = getConfigItemBoolValue(configFile, sectionName, "forget_password_require_email_verify", false)
856+
config.EnableTwoFactor = getConfigItemBoolValue(configFile, sectionName, "enable_two_factor", true)
858857
config.EnableTransactionPictures = getConfigItemBoolValue(configFile, sectionName, "enable_transaction_picture", false)
859858
config.MaxTransactionPictureFileSize = getConfigItemUint32Value(configFile, sectionName, "max_transaction_picture_size", defaultTransactionPictureFileMaxSize)
860859
config.EnableScheduledTransaction = getConfigItemBoolValue(configFile, sectionName, "enable_scheduled_transaction", false)

0 commit comments

Comments
 (0)