-
This commit is contained in:
@ -29,6 +29,10 @@ func (c *TestConfig) GetBool(key string) bool {
|
||||
return boolVal
|
||||
}
|
||||
}
|
||||
// Special handling for cache enabled
|
||||
if key == "CACHE_ENABLED" {
|
||||
return c.values[key] == "true"
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
@ -86,6 +90,10 @@ func (c *TestConfig) IsProduction() bool {
|
||||
return c.GetString("APP_ENV") == "production"
|
||||
}
|
||||
|
||||
func (c *TestConfig) GetJWTSecret() string {
|
||||
return c.GetString("JWT_SECRET")
|
||||
}
|
||||
|
||||
// NewTestConfig creates a test configuration with default values
|
||||
func NewTestConfig() *TestConfig {
|
||||
return &TestConfig{
|
||||
@ -99,6 +107,12 @@ func NewTestConfig() *TestConfig {
|
||||
"SERVER_HOST": "localhost",
|
||||
"SERVER_PORT": "8080",
|
||||
"APP_ENV": "test",
|
||||
"JWT_SECRET": "test-jwt-secret-for-testing-only",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// NewMockConfig creates a mock configuration (alias for NewTestConfig for backward compatibility)
|
||||
func NewMockConfig() *TestConfig {
|
||||
return NewTestConfig()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user