Skip to content

Commit

Permalink
v0.5: (BREAKING) simplified config format, improved error output, upd…
Browse files Browse the repository at this point in the history
…ated proxy entry default value for 'port'
  • Loading branch information
default committed Aug 13, 2024
1 parent 23e7d06 commit 719693d
Show file tree
Hide file tree
Showing 21 changed files with 193 additions and 298 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.22.6-alpine as builder
FROM golang:1.22.6-alpine AS builder
COPY src /src
ENV GOCACHE=/root/.cache/go-build
WORKDIR /src
Expand Down
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,14 @@ autocert:
- ...
# reverse proxy providers configuration
providers:
entry_1:
kind: docker
value: # `FROM_ENV` or full url to docker host
entry_2:
kind: file
value: # relative path of file to `config/`
include:
- providers.yml
- other_file_1.yml
- ...
docker:
local: $DOCKER_HOST
remote-1: tcp://10.0.2.1:2375
remote-2: ssh://root:[email protected]
```
[🔼Back to top](#table-of-content)
Expand Down
24 changes: 14 additions & 10 deletions config.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,26 @@
# provider: cloudflare
# email: # ACME Email
# domains: # a list of domains for cert registration
# -
# - x.y.z
# options:
# - auth_token: # your zone API token
# - auth_token: c1234565789-abcdefghijklmnopqrst # your zone API token

# 3. other providers, check readme for more

providers:
local:
kind: docker
include:
- providers.yml # config/providers.yml
# add some more below if you want
# - file1.yml # config/file_1.yml
# - file2.yml
docker:
# for value format, see https://docs.docker.com/reference/cli/dockerd/
# i.e. ssh://[email protected]:22, tcp://10.0.2.1:2375
# use FROM_ENV if you have binded docker socket to /var/run/docker.sock
value: FROM_ENV
providers:
kind: file
value: providers.yml
# $DOCKER_HOST implies unix:///var/run/docker.sock by default
local: $DOCKER_HOST
# add more docker providers if needed
# remote-1: tcp://10.0.2.1:2375
# remote-2: ssh://root:[email protected]

# Fixed options (optional, non hot-reloadable)

# timeout_shutdown: 5
Expand Down
137 changes: 49 additions & 88 deletions schema/config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,7 @@
"provider": {
"title": "DNS Challenge Provider",
"type": "string",
"enum": [
"local",
"cloudflare",
"clouddns",
"duckdns"
]
"enum": ["local", "cloudflare", "clouddns", "duckdns"]
},
"options": {
"title": "Provider specific options",
Expand All @@ -57,12 +52,7 @@
}
},
"then": {
"required": [
"email",
"domains",
"provider",
"options"
]
"required": ["email", "domains", "provider", "options"]
}
},
{
Expand All @@ -76,9 +66,7 @@
"then": {
"properties": {
"options": {
"required": [
"auth_token"
],
"required": ["auth_token"],
"additionalProperties": false,
"properties": {
"auth_token": {
Expand All @@ -101,11 +89,7 @@
"then": {
"properties": {
"options": {
"required": [
"client_id",
"email",
"password"
],
"required": ["client_id", "email", "password"],
"additionalProperties": false,
"properties": {
"client_id": {
Expand Down Expand Up @@ -136,9 +120,7 @@
"then": {
"properties": {
"options": {
"required": [
"token"
],
"required": ["token"],
"additionalProperties": false,
"properties": {
"token": {
Expand All @@ -155,73 +137,54 @@
"providers": {
"title": "Proxy providers configuration",
"type": "object",
"patternProperties": {
"^[a-zA-Z0-9_-]+$": {
"description": "Proxy provider",
"additionalProperties": false,
"properties": {
"include": {
"title": "Proxy providers configuration files",
"description": "relative path to 'config'",
"type": "array",
"items": {
"type": "string",
"pattern": "^[a-zA-Z0-9_-]+\\.(yml|yaml)$",
"patternErrorMessage": "Invalid file name"
}
},
"docker": {
"title": "Docker provider configuration",
"description": "docker clients (name: address)",
"type": "object",
"properties": {
"kind": {
"description": "Proxy provider kind",
"patternProperties": {
"^[a-zA-Z0-9-_]+$": {
"type": "string",
"enum": [
"docker",
"file"
]
},
"value": {
"type": "string"
}
},
"required": [
"kind",
"value"
],
"allOf": [
{
"if": {
"properties": {
"kind": {
"const": "docker"
}
}
},
"then": {
"if": {
"properties": {
"value": {
"const": "FROM_ENV"
}
}
"examples": [
"unix:///var/run/docker.sock",
"tcp://127.0.0.1:2375",
"ssh://user@host:port"
],
"oneOf": [
{
"const": "$DOCKER_HOST",
"description": "Use DOCKER_HOST environment variable"
},
"then": {
"properties": {
"value": {
"description": "use docker client from environment"
}
}
{
"pattern": "^unix://.+$",
"description": "A Unix socket for local Docker communication."
},
"else": {
"properties": {
"value": {
"description": "docker client URL",
"examples": [
"unix:///var/run/docker.sock",
"tcp://127.0.0.1:2375",
"ssh://user@host:port"
]
}
}
}
},
"else": {
"properties": {
"value": {
"description": "file path"
}
{
"pattern": "^ssh://.+$",
"description": "An SSH connection to a remote Docker host."
},
{
"pattern": "^fd://.+$",
"description": "A file descriptor for Docker communication."
},
{
"pattern": "^tcp://.+$",
"description": "A TCP connection to a remote Docker host."
}
}
]
}
]
}
}
}
},
Expand All @@ -236,7 +199,5 @@
}
},
"additionalProperties": false,
"required": [
"providers"
]
}
"required": ["providers"]
}
17 changes: 5 additions & 12 deletions schema/providers.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
]
},
"host": {
"anyOf": [
"oneOf": [
{
"type": "string",
"format": "ipv4",
Expand Down Expand Up @@ -69,9 +69,7 @@
"set_headers": {},
"hide_headers": {}
},
"required": [
"host"
],
"required": ["host"],
"additionalProperties": false,
"allOf": [
{
Expand All @@ -80,10 +78,7 @@
{
"properties": {
"scheme": {
"enum": [
"http",
"https"
]
"enum": ["http", "https"]
}
}
},
Expand Down Expand Up @@ -171,9 +166,7 @@
"not": true
}
},
"required": [
"port"
]
"required": ["port"]
}
},
{
Expand All @@ -198,4 +191,4 @@
}
},
"additionalProperties": false
}
}
Loading

0 comments on commit 719693d

Please sign in to comment.