@@ -157,6 +157,7 @@ func TestServerCmd_AllArgs_Defaults(t *testing.T) {
157157 {"term-height default" , FlagTermHeight , uint16 (1000 ), func () any { return viper .GetUint16 (FlagTermHeight ) }},
158158 {"allowed-hosts default" , FlagAllowedHosts , []string {"localhost" }, func () any { return viper .GetStringSlice (FlagAllowedHosts ) }},
159159 {"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 ) }},
160161 }
161162
162163 for _ , tt := range tests {
@@ -191,6 +192,7 @@ func TestServerCmd_AllEnvVars(t *testing.T) {
191192 {"AGENTAPI_TERM_HEIGHT" , "AGENTAPI_TERM_HEIGHT" , "500" , uint16 (500 ), func () any { return viper .GetUint16 (FlagTermHeight ) }},
192193 {"AGENTAPI_ALLOWED_HOSTS" , "AGENTAPI_ALLOWED_HOSTS" , "localhost example.com" , []string {"localhost" , "example.com" }, func () any { return viper .GetStringSlice (FlagAllowedHosts ) }},
193194 {"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 ) }},
194196 }
195197
196198 for _ , tt := range tests {
@@ -268,6 +270,13 @@ func TestServerCmd_ArgsPrecedenceOverEnv(t *testing.T) {
268270 []string {"https://cli-example.com" },
269271 func () any { return viper .GetStringSlice (FlagAllowedOrigins ) },
270272 },
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+ },
271280 }
272281
273282 for _ , tt := range tests {
0 commit comments