-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
1,267 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
name: build | ||
|
||
on: | ||
push: | ||
branches: | ||
- '*' | ||
tags-ignore: | ||
- '*' | ||
pull_request: | ||
types: | ||
- opened | ||
- reopened | ||
|
||
jobs: | ||
goreleaser: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: ^1.22 | ||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v4 | ||
with: | ||
distribution: goreleaser | ||
version: latest | ||
args: release --snapshot --clean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
name: release | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
goreleaser: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: ^1.22 | ||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v4 | ||
with: | ||
distribution: goreleaser | ||
version: latest | ||
args: release --clean | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--- | ||
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json | ||
# vim: set ts=2 sw=2 tw=0 fo=cnqoj | ||
|
||
version: 1 | ||
|
||
before: | ||
hooks: | ||
- go mod tidy | ||
|
||
builds: | ||
- env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- linux | ||
- windows | ||
- darwin | ||
|
||
archives: | ||
- format: tar.gz | ||
# this name template makes the OS and Arch compatible with the results of `uname`. | ||
name_template: >- | ||
{{ .ProjectName }}_ | ||
{{- .Version }}_ | ||
{{- title .Os }}_ | ||
{{- if eq .Arch "amd64" }}x86_64 | ||
{{- else if eq .Arch "386" }}i386 | ||
{{- else }}{{ .Arch }}{{ end }} | ||
{{- if .Arm }}v{{ .Arm }}{{ end }} | ||
# use zip for windows archives | ||
format_overrides: | ||
- goos: windows | ||
format: zip | ||
|
||
changelog: | ||
sort: asc | ||
filters: | ||
exclude: | ||
- '^docs:' | ||
- '^test:' | ||
- '^chore:' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
# ⭐ Gorge | ||
|
||
Gorge is a go implementation for [forgeapi.puppet.com](https://forgeapi.puppet.com/). | ||
|
||
## 🌹 Installation | ||
|
||
Via `go install`: | ||
|
||
```bash | ||
go install github.com/dadav/gorge@latest | ||
``` | ||
|
||
## 💎 Usage | ||
|
||
```bash | ||
Run this command to start serving your own puppet modules. | ||
You can also enable a fallback proxy to forward the requests to | ||
when you don't have the requested module in your local module | ||
set yet. | ||
You can also enable the caching functionality to speed things up. | ||
Usage: | ||
gorge serve [flags] | ||
Flags: | ||
--api-version string the forge api version to use (default "v3") | ||
--backend string backend to use (default "filesystem") | ||
--bind string host to listen to | ||
--cache-prefixes string url prefixes to cache (default "/v3/files") | ||
--cachedir string cache directory (default "/var/cache/gorge") | ||
--cors string allowed cors origins separated by comma (default "*") | ||
--dev enables dev mode | ||
--fallback-proxy string optional fallback upstream proxy url | ||
-h, --help help for serve | ||
--modulesdir string directory containing all the modules (default "/opt/gorge/modules") | ||
--no-cache disables the caching functionality | ||
--port int the port to listen to (default 8080) | ||
Global Flags: | ||
--config string config file (default is $HOME/.gorge.yaml) | ||
``` | ||
## 🐂 Examples | ||
```bash | ||
# use the pupeptlabs forge as fallback | ||
gorge serve --fallback-proxy https://forge.puppetlabs.com | ||
# enable cache for every request | ||
gorge serve --fallback-proxy https://forge.puppetlabs.com --cache-prefixes /v3 | ||
``` | ||
## 🍰 Configuration | ||
Use the `$HOME/.config/gorge.yaml` (or `./gorge.yaml`): | ||
```yaml | ||
--- | ||
api-version: v3 | ||
backend: filesystem | ||
bind: 127.0.0.1 | ||
cache-prefixes: /v3/files | ||
cachedir: /var/cache/gorge | ||
cors: "*" | ||
dev: false | ||
fallback-proxy: | ||
modulesdir: /opt/gorge/modules | ||
no-cache: false | ||
port: 8080 | ||
``` | ||
Or the environment: | ||
```bash | ||
GORGE_API_VERSION: v3 | ||
GORGE_BACKEND: filesystem | ||
GORGE_BIND: 127.0.0.1 | ||
GORGE_CACHE_PREFIXES: /v3/files | ||
GORGE_CACHEDIR: /var/cache/gorge | ||
GORGE_CORS: "*" | ||
GORGE_DEV: false | ||
GORGE_FALLBACK_PROXY: | ||
GORGE_MODULESDIR: /opt/gorge/modules | ||
GORGE_NO_CACHE: false | ||
GORGE_PORT: 8080 | ||
``` | ||
## 🔑 License | ||
[Apache](./LICENSE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package cmd | ||
|
||
var apiVersion string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.