Skip to content

Read Ript rules from JSON #5

@auxesis

Description

@auxesis

The Ript DSL is pretty much just a nested set of method invocations:

partition "bar" do
  label "www.bar.com",    :address => "172.23.0.95"
  label "barprod-web-01", :address => "192.168.19.2"
  label "barprod-web-02", :address => "192.168.19.4"

  rewrite "bar.com public website" do
    ports 80
    dnat  "www.bar.com" => "barprod-web-01"
  end

  rewrite "bar.com public website" do
    ports 22
    dnat  "www.bar.com" => "barprod-web-02"
  end
end

We could in theory represent this as JSON:

{
  "partition": {
    "name": "bar",
    "labels": {
      "www.bar.com.au": {
        "address": "172.23.0.95"
      },
      "barprod-web-01": {
        "address": "192.168.19.2"
      },
      "barprod-web-02": {
        "address": "192.168.19.4"
      }
    },
    "rules": [
      {
        "rewrite": {
          "ports": 80,
          "dnat": {
            "www.bar.com": "barprod-web-01"
          }
        }
      },
      {
        "rewrite": {
          "ports": 22,
          "dnat": {
            "www.bar.com": "barprod-web-02"
          }
        }
      }
    ]
  }
}

This would allow other systems to generate JSON that Ript could consume, and allow for dynamic rule generation through configuration management or customer portals.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions