inventory.json to srp config.json conversion utility
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-09-11 18:43:45 +01:00
go.mod update module path 2026-09-11 18:43:45 +01:00
go.sum rename module to inv2config, remove up dependency 2020-07-12 07:26:47 -07:00
LICENSE replace isc license with agpl 2026-09-11 18:19:10 +01:00
main.go support new inventory.json format 2020-11-06 13:46:28 -08:00
README.md support new inventory.json format 2020-11-06 13:46:28 -08:00
srp.go initial commit 2020-03-31 14:58:42 -07:00

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.