Miscellaneous minor configuration related fixes.

This commit is contained in:
Catherine
2025-09-22 01:30:32 +00:00
parent bf2922f892
commit d81676fea0
5 changed files with 51 additions and 35 deletions

2
.gitignore vendored
View File

@@ -2,4 +2,4 @@
/result-*
/bin
/data
/config.toml*
/config*.toml*

View File

@@ -35,7 +35,7 @@ WORKDIR /app
RUN mkdir /app/data
COPY conf/supervisord.conf /app/supervisord.conf
COPY conf/Caddyfile /app/Caddyfile
COPY conf/config.toml.example /app/config.toml
COPY conf/config.example.toml /app/config.toml
# Caddy ports:
EXPOSE 80/tcp 443/tcp 443/udp 2019/tcp

View File

@@ -1,33 +1,45 @@
# log-format = "datetime+message"
# Unless otherwise noted, every value in this file is the same
# as the intrinsic default value.
# [listen]
# pages = "tcp/:3000"
# caddy = "tcp/:3001" # or "-" to disable
# health = "tcp/:3002"
log-format = "datetime+message"
# [[wildcard]]
# domain = "codeberg.page"
# clone-url = "https://codeberg.org/<user>/<project>.git"
# index-repos = ["<user>.codeberg.page", "pages"]
# fallback-proxy-to = "https://codeberg.page"
[listen]
# Use "-" to turn off the listener.
pages = "tcp/:3000"
caddy = "tcp/:3001"
health = "tcp/:3002"
# [backend]
# type = "fs"
[[wildcard]] # non-default section
domain = "codeberg.page"
clone-url = "https://codeberg.org/<user>/<project>.git"
index-repos = ["<user>.codeberg.page", "pages"]
fallback-proxy-to = "https://codeberg.page"
# [backend.fs]
# root = "./data"
[backend]
type = "fs"
# [backend.s3]
# endpoint = "play.min.io"
# access-key-id = "Q3AM3UQ867SPQQA43P2F"
# secret-access-key = "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG"
# region = "us-east-1"
# bucket = "git-pages-demo"
[backend.fs]
root = "./data"
# [limits]
# max-site-size = "128M"
# max-manifest-size = "1M"
# max-inline-file-size = "256B"
# git-large-object-threshold = "1M"
# max-symlink-depth = 16
# update-timeout = "60s"
[backend.s3] # non-default bucket configuration
endpoint = "play.min.io"
access-key-id = "Q3AM3UQ867SPQQA43P2F"
secret-access-key = "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG"
region = "us-east-1"
bucket = "git-pages-demo"
[backend.s3.blob-cache]
max-size = "256MB"
[backend.s3.site-cache]
max-size = "16MB"
max-age = "60s"
[limits]
max-site-size = "128M"
max-manifest-size = "1M"
max-inline-file-size = "256B"
git-large-object-threshold = "1M"
max-symlink-depth = 16
update-timeout = "60s"
max-heap-size-ratio = 0.5

View File

@@ -1,9 +1,10 @@
# Requires secrets to be set:
# - ACME_EMAIL
# - S3_ENDPOINT
# - S3_ACCESS_KEY_ID
# - S3_SECRET_ACCESS_KEY
# - S3_BUCKET
# - GIT_PAGES_CONFIG
# - PAGES_CONFIG
[build]
dockerfile = "Dockerfile"
@@ -23,7 +24,7 @@ AUTOMEMLIMIT = "0.25"
[[files]]
guest_path = "/app/config.toml"
secret_name = "GIT_PAGES_CONFIG"
secret_name = "PAGES_CONFIG"
[[services]]
internal_port = 80

View File

@@ -79,9 +79,12 @@ func serve(listener net.Listener, serve func(http.ResponseWriter, *http.Request)
func main() {
InitObservability()
configPath := flag.String("config", "config.toml", "path to configuration file")
printConfig := flag.Bool("print-config", false, "print final configuration as JSON")
getManifest := flag.String("get-manifest", "", "retrieve manifest for web root as ProtoJSON")
configPath := flag.String("config", "config.toml",
"path to configuration file")
checkConfig := flag.Bool("check-config", false,
"validate configuration, print it as JSON, and exit")
getManifest := flag.String("get-manifest", "",
"retrieve manifest for web root as ProtoJSON")
flag.Parse()
if err := ReadConfig(*configPath); err != nil {
@@ -89,7 +92,7 @@ func main() {
}
UpdateConfigEnv() // environment takes priority
if *printConfig {
if *checkConfig {
configJSON, _ := json.MarshalIndent(&config, "", " ")
fmt.Println(string(configJSON))
return