inventory.json to srp config.json conversion utility
- Go 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| go.mod | ||
| go.sum | ||
| LICENSE | ||
| main.go | ||
| README.md | ||
| srp.go | ||
inventory2config
Takes an inventory.json and a service-based SRP config file as inputs and outputs an SRP config file pointing at specific IPs.
Example inventory.json:
{
"gcp:my-project:us-central1:us-central1-b": {
"internal": {"10.128.0.1": ["my-app"]},
"external": {"100.10.1.1": ["my-app"]}
}
}
Example service-based SRP config file:
{
"Services": {
"www.example.com": {
"HealthPath": "/health",
"Service": "my-app",
"Port": 3000
},
"www-example.internal": {
"HealthPath": "/health",
"Service": "my-app",
"Port": 3001
}
}
}
To use:
inv2config \
-i inventory.json \
-c config_service.json \
-p "gcp:my-project:us-central1:us-central1-b" > config.json
This outputs a config.json with backends populated with the correct ip:port combinations like so:
{
"Services": {
"www.example.com": {
"HealthPath": "/health",
"Service": "my-app",
"Port": 3000,
"Backends": ["10.128.0.1:3000"]
},
"www-example.internal": {
"HealthPath": "/health",
"Service": "my-app",
"Port": 3001,
"Backends": ["10.128.0.1:3001"]
}
}
}
SRP will ignore the Service and Port. They are added for this tool only.