https://github.com/daeuniverse/functions
https://github.com/daeuniverse/functions
daeuniverse serverless
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/daeuniverse/functions
- Owner: daeuniverse
- License: mit
- Created: 2023-06-04T07:56:07.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-08-20T14:46:06.000Z (over 2 years ago)
- Last Synced: 2025-01-14T10:31:47.080Z (over 1 year ago)
- Topics: daeuniverse, serverless
- Language: Go
- Homepage: https://function.v2raya.org/api/v2/index
- Size: 47.9 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# Functions
## Intro
A serverless functions for internal interaction with [@daeuniverse](https://github.com/daeuniverse)
## Prerequisites
Export `GITHUB_TOKEN` as environment variable
```bash
export GITHUB_TOKEN=
# ONLY needed for workflow routes
# export AUTH_TOKEN=
```
## How to use
```bash
go run main.go
```
## API Comsumption
- healthcheck - `/GET localhost:5888/api/v2/health`
- fetch geodata(geosite.dat) - `/GET localhost:5888/api/v2/geodata?file=geosite.dat`
- fetch geodata(geoip.dat) - `/GET localhost:5888/api/v2/geodata?file=geoip.dat`
- trigger daed-pick-build - `/POST localhost:5888/api/v2/workflow?name=daed-pick-build&daed=main&wing=origin/main&dae=origin/main`
## References
- [go-chi-v5](https://pkg.go.dev/github.com/go-chi/chi/v5)
- [go-resty](https://pkg.go.dev/github.com/go-resty/resty/v2)
- [go-github-sdk](https://pkg.go.dev/github.com/google/go-github/v52/github)
- [How to pipe http.Response to http.ResponseWriter](https://stackoverflow.com/questions/28891531/piping-http-response-to-http-responsewriter)
- [Golang communicating the name of the file served to the browser/client](https://stackoverflow.com/questions/44510661/golang-communicating-the-name-of-the-file-served-to-the-browser-client)