Skip to content

Router that virtually distributes inference across connected devices in the home.

Go
3.9 KB
Raw Blame
[
  {
    "name": "separate-flags",
    "input": "-q23456 --listen-address=127.0.0.1 --browser",
    "policy": [
      "cors.enabled=true"
    ],
    "invalid": [
      "-q0",
      "--listen-address=0.0.0.0",
      "--browser=false"
    ],
    "definition": {
      "fixed_args": [
        "server",
        "start"
      ],
      "controls": [
        {
          "flags": [
            "--api-port",
            "-q"
          ],
          "value": "{server.port}"
        },
        {
          "flags": [
            "--listen-address"
          ],
          "value": "{server.host}"
        },
        {
          "flags": [
            "--browser"
          ],
          "value": "{cors.enabled}",
          "implicit": "true"
        }
      ]
    }
  },
  {
    "name": "environment-only",
    "input": "ALT_PORT=23456 API_HOST=127.0.0.1 WEB_ACCESS=1",
    "policy": [
      "cors.enabled=true"
    ],
    "invalid": [
      "API_PORT=23456 ALT_PORT=23457",
      "API_HOST=0.0.0.0",
      "WEB_ACCESS=maybe"
    ],
    "definition": {
      "fixed_args": [
        "server",
        "start"
      ],
      "controls": [
        {
          "env": [
            "API_PORT",
            "ALT_PORT"
          ],
          "value": "{server.port}"
        },
        {
          "env": [
            "API_HOST"
          ],
          "value": "{server.host}"
        },
        {
          "env": [
            "WEB_ACCESS"
          ],
          "value": "{cors.enabled}"
        }
      ]
    }
  },
  {
    "name": "url-address",
    "input": "-etcp://127.0.0.1:23456 -ohttps://example.test",
    "policy": [
      "cors.origins=https://example.test"
    ],
    "invalid": [
      "--endpoint=tcp://0.0.0.0:23456",
      "--endpoint=127.0.0.1:23456",
      "--endpoint=tcp://127.0.0.1:0",
      "--origins='\"*\"'"
    ],
    "definition": {
      "fixed_args": [
        "server",
        "start"
      ],
      "controls": [
        {
          "flags": [
            "--endpoint",
            "-e"
          ],
          "env": [
            "ENDPOINT"
          ],
          "value": "tcp://{server.host}:{server.port}"
        },
        {
          "flags": [
            "--origins",
            "-o"
          ],
          "value": "{cors.origins}"
        }
      ]
    }
  },
  {
    "name": "ipv6-address",
    "host": "::1",
    "input": "WEB_ACCESS=true --endpoint=http://[::1]:23456 --web-access",
    "policy": [
      "cors.enabled=true"
    ],
    "invalid": [
      "--endpoint=http://[::]:23456",
      "--endpoint=http://[::1]:65536",
      "WEB_ACCESS=false --web-access"
    ],
    "definition": {
      "fixed_args": [
        "server",
        "start"
      ],
      "controls": [
        {
          "flags": [
            "--endpoint"
          ],
          "value": "http://[{server.host}]:{server.port}"
        },
        {
          "flags": [
            "--web-access"
          ],
          "env": [
            "WEB_ACCESS"
          ],
          "value": "{cors.enabled}",
          "implicit": "true"
        }
      ]
    }
  },
  {
    "name": "reordered-address-and-negative-switch",
    "input": "ENDPOINT=\"port=23456;host=127.0.0.1\" -n",
    "policy": [
      "cors.enabled=false"
    ],
    "invalid": [
      "--no-browser --browser",
      "ENDPOINT=\"port=0;host=127.0.0.1\"",
      "ENDPOINT=\"port=23456;host=0.0.0.0\""
    ],
    "definition": {
      "fixed_args": [
        "server",
        "start"
      ],
      "controls": [
        {
          "env": [
            "ENDPOINT"
          ],
          "flags": [
            "--endpoint"
          ],
          "value": "port={server.port};host={server.host}"
        },
        {
          "flags": [
            "--no-browser",
            "-n"
          ],
          "value": "{cors.enabled}",
          "implicit": "false"
        },
        {
          "flags": [
            "--browser"
          ],
          "value": "{cors.enabled}",
          "implicit": "true"
        }
      ]
    }
  }
]