@@ -157,6 +157,7 @@ func TestServerCmd_AllArgs_Defaults(t *testing.T) {
157
157
{"term-height default" , FlagTermHeight , uint16 (1000 ), func () any { return viper .GetUint16 (FlagTermHeight ) }},
158
158
{"allowed-hosts default" , FlagAllowedHosts , []string {"localhost" }, func () any { return viper .GetStringSlice (FlagAllowedHosts ) }},
159
159
{"allowed-origins default" , FlagAllowedOrigins , []string {"http://localhost:3284" , "http://localhost:3000" , "http://localhost:3001" }, func () any { return viper .GetStringSlice (FlagAllowedOrigins ) }},
160
+ {"use-x-forwarded-host default" , FlagUseXForwardedHost , false , func () any { return viper .GetBool (FlagUseXForwardedHost ) }},
160
161
}
161
162
162
163
for _ , tt := range tests {
@@ -191,6 +192,7 @@ func TestServerCmd_AllEnvVars(t *testing.T) {
191
192
{"AGENTAPI_TERM_HEIGHT" , "AGENTAPI_TERM_HEIGHT" , "500" , uint16 (500 ), func () any { return viper .GetUint16 (FlagTermHeight ) }},
192
193
{"AGENTAPI_ALLOWED_HOSTS" , "AGENTAPI_ALLOWED_HOSTS" , "localhost example.com" , []string {"localhost" , "example.com" }, func () any { return viper .GetStringSlice (FlagAllowedHosts ) }},
193
194
{"AGENTAPI_ALLOWED_ORIGINS" , "AGENTAPI_ALLOWED_ORIGINS" , "https://example.com http://localhost:3000" , []string {"https://example.com" , "http://localhost:3000" }, func () any { return viper .GetStringSlice (FlagAllowedOrigins ) }},
195
+ {"AGENTAPI_USE_X_FORWARDED_HOST" , "AGENTAPI_USE_X_FORWARDED_HOST" , "true" , true , func () any { return viper .GetBool (FlagUseXForwardedHost ) }},
194
196
}
195
197
196
198
for _ , tt := range tests {
@@ -268,6 +270,13 @@ func TestServerCmd_ArgsPrecedenceOverEnv(t *testing.T) {
268
270
[]string {"https://cli-example.com" },
269
271
func () any { return viper .GetStringSlice (FlagAllowedOrigins ) },
270
272
},
273
+ {
274
+ "use-x-forwarded-host: CLI overrides env" ,
275
+ "AGENTAPI_USE_X_FORWARDED_HOST" , "false" ,
276
+ []string {"--use-x-forwarded-host" },
277
+ true ,
278
+ func () any { return viper .GetBool (FlagUseXForwardedHost ) },
279
+ },
271
280
}
272
281
273
282
for _ , tt := range tests {
0 commit comments