Skip to content

feat: flesh out strategies + server + config#11

Merged
alecthomas merged 1 commit intomainfrom
aat/server-and-strategy
Jan 7, 2026
Merged

feat: flesh out strategies + server + config#11
alecthomas merged 1 commit intomainfrom
aat/server-and-strategy

Conversation

@alecthomas
Copy link
Copy Markdown
Collaborator

This implements a "direct host" strategy, and a "default" strategy that replaces the remote server component.

eg.

Server

~/dev/sfptc $ cat sfptc.hcl
# strategy git {}
# strategy docker {}
# strategy hermit {}
# strategy artifactory {
#   mitm = ["artifactory.global.square"]
# }

host "/github/" {
  target = "https://github.com/"
}

disk {
  root = "./cache"
}

~/dev/sfptc $ sfptcd --config=sfptc.hcl --log-level=debug
DBG Cache backend cache=disk:/Users/alec/dev/sfptc/cache
DBG Adding strategy strategy=default pattern=/api/v1/
DBG Adding strategy strategy=host:github.com/ pattern=/github/
INF Starting sfptcd bind=127.0.0.1:8080

Client:

~/dev/sfptc $ curl http://127.0.0.1:8080/github/foo | wc                    aat/server-and-strategy
~/dev/sfptc $ curl -H 'Time-To-Live: 1h' --data-binary 'Hello world' -i http://127.0.0.1:8080/api/v1/01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b
HTTP/1.1 200 OK
Date: Wed, 07 Jan 2026 03:04:47 GMT
Content-Length: 0

~/dev/sfptc $ curl -i http://127.0.0.1:8080/api/v1/01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b
HTTP/1.1 200 OK
Date: Wed, 07 Jan 2026 03:05:24 GMT
Content-Length: 11
Content-Type: text/plain; charset=utf-8

Hello world

This implements a "direct host" strategy, and a "default" strategy that
replaces the remote server component.
@alecthomas alecthomas enabled auto-merge (squash) January 7, 2026 03:06
@alecthomas alecthomas merged commit 342d757 into main Jan 7, 2026
4 checks passed
@alecthomas alecthomas deleted the aat/server-and-strategy branch January 7, 2026 03:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant