Skip to content

Instantly share code, notes, and snippets.

@jamesbeedy
Created December 1, 2017 17:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesbeedy/b784bfd8779fca668b536332a10be5c1 to your computer and use it in GitHub Desktop.
Save jamesbeedy/b784bfd8779fca668b536332a10be5c1 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
import yaml
PRIVATE_IP = "100.100.100.100"
WEB_PORT = 9000
API_PORT = 9001
services = [{'service_name': "mytestservice",
'service_host': "0.0.0.0",
'service_port': 80,
'service_options': ["mode http", "acl api path_beg -i /api", "use_backend api if api"],
'servers': [["mytestservice", PRIVATE_IP, WEB_PORT, "option httpchk GET / HTTP/1.0"]],
'backends': {'backend_name': "api",
'servers': [["mytestservice-api", PRIVATE_IP, API_PORT, "option httpchk GET /api HTTP/1.0"]]}}]
print(yaml.dump(services))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment