Configuration management and multi-service support
Now you can use the config file and env variables to configure GoReplay. Additionally, you now can manage multiple services with a single instance.
Example usage with a config file:
goreplay.yaml (looks up in current dir, /etc/goreplay/ and `~/.goreplay/ folders)
verbose: 2
services:
app1:
input-raw: 9090
output-http: https://replay.com
app2:
input-raw: 8080
output-s3: s3://mybucket/req.gor
Operations defined outside of the "services" section are global ones and applied to all services. For example, you can have global input, but two different independent outputs, or vice versa. Additionally, you can define global and per service modifiers and filters.
When you need to specify multiple values, just use YAML format. Both single and array values supported. Example:
verbose: 2
input-raw: 80
output-dummy: true
services:
foo:
input-raw: 8080
output-http: http://example.com
http-allow-header: "single:.*"
http-set-header:
- "Foo: bar"
- "Bar: foo"
Using environment variables
All env variables should start with GR_ prefix.
Should be way easier to use in CI/CD flows now. Example with env variables:
GR_SERVICE=foo GR_INPUT_RAW=:80 GR_OUTPUT_FILE=requests.gor goreplay
At the moment it is not possible to specify multiple services via ENV vars.
@urbanishimwe any ideas why this test fails?
i try to merge config-management to master, but found some problem
config settings
type ServiceSettings struct {
...
InputRAW MultiOption json:"input-raw" mapstructure:"input-raw"
...
}
then i run: /private/var/folders/jl/7524zq312p59fxz3msgtsl7c0000gn/T/___go_build_github_com_buger_goreplay --input-raw :8000 --output-tcp :8002 #gosetup 2021/08/17 19:32:24 input-raw: error while parsing address: address [:8000]: missing port in address
the InputRaw Filed could not parse params correctly.
it should be parse to :8000 but [:8000] when --input-raw :8000 --input-raw :8001 , InputRAW value is [:8000 8001] and :8001
how i could solve this problem ?
i try to merge config-management to master, but found some problem
config settings type ServiceSettings struct { ... InputRAW MultiOption
json:"input-raw" mapstructure:"input-raw"... }then i run: /private/var/folders/jl/7524zq312p59fxz3msgtsl7c0000gn/T/___go_build_github_com_buger_goreplay --input-raw :8000 --output-tcp :8002 #gosetup 2021/08/17 19:32:24 input-raw: error while parsing address: address [:8000]: missing port in address
the InputRaw Filed could not parse params correctly.
it should be parse to :8000 but [:8000] when --input-raw :8000 --input-raw :8001 , InputRAW value is [:8000 8001] and :8001
how i could solve this problem ?
i has fixed it is caused by switching the command parser library from flag to pflag the solution is to use pflag to parse the multioption
This is a great feature, why isn't it incorporated into the Master Is there anyone left to push the merger