flipt-io / cup

Git Contribution Automation
https://cup.flipt.io
Apache License 2.0
76 stars 1 forks source link

feat(api): add initial server implementation #19

Closed GeorgeMac closed 1 year ago

GeorgeMac commented 1 year ago

Fixes #12

Implements a first stab at *api.Server.

This includes all the planned routes:

A realization as I was implementing everything, was that the billy.Filesystem from go-git is a useful lowest-common denominator abstraction for a writable filesystem. It should work nicely with the git.FilesystemStore implementation.

To support testing PR includes implementations of both:

The new package pkg/mem includes a dummy in-memory FilesystemStore. It lets the user register implementations of billy.Filesystem under a source and revision.

The new package pkg/controllers/template includes an in-cup implementation of a Controller. It uses (eventually) configurable text/template instances to derive where a resource should live on the target filesystem. I have a feeling this can be extended so that it is directly configurable from cup config, allowing us to support some basic functionality without a WASM implementation.

GeorgeMac commented 1 year ago

Im going through a PR process for posterity. But I will just go ahead a yolo merge these while in get the POC done phase.