Skip to content

Commit 70d0616

Browse files
Improvement of the available nginx configuration options (#45)
1 parent 20e8437 commit 70d0616

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1118
-842
lines changed

.github/workflows/release.yml

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,14 @@ jobs:
1313
- uses: actions/checkout@v5
1414
- uses: actions/setup-node@v4
1515
with:
16-
node-version: 22
16+
node-version: 24
17+
cache: 'npm'
18+
cache-dependency-path: frontend/package-lock.json
1719
- uses: actions/setup-go@v5
1820
with:
19-
go-version: 1.25.4
21+
go-version: 1.25.5
22+
cache: true
23+
cache-dependency-path: "**/go.sum"
2024
- name: Install nfpm
2125
run: |
2226
echo 'deb [trusted=yes] https://repo.goreleaser.com/apt/ /' | sudo tee /etc/apt/sources.list.d/goreleaser.list
@@ -34,16 +38,6 @@ jobs:
3438
with:
3539
username: ${{ secrets.DOCKERHUB_USERNAME }}
3640
password: ${{ secrets.DOCKERHUB_TOKEN }}
37-
- name: npm cache download
38-
uses: actions/cache/restore@v4
39-
with:
40-
path: ${{ github.workspace }}/frontend/node_modules
41-
key: npm-cache
42-
- name: go cache download
43-
uses: actions/cache/restore@v4
44-
with:
45-
path: ${{ github.workspace }}/.go
46-
key: go-cache
4741
- name: Resolve version number from tag
4842
id: tag
4943
run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3)
@@ -53,16 +47,6 @@ jobs:
5347
GOMODCACHE: ${{ github.workspace }}/.go/pkg/mod
5448
GOTOOLCHAIN: ""
5549
run: make build-release VERSION=${{ steps.tag.outputs.VERSION }}
56-
- name: npm cache upload
57-
uses: actions/cache/save@v4
58-
with:
59-
path: ${{ github.workspace }}/frontend/node_modules
60-
key: npm-cache
61-
- name: go cache upload
62-
uses: actions/cache/save@v4
63-
with:
64-
path: ${{ github.workspace }}/.go
65-
key: go-cache
6650
- name: Create GitHub Release
6751
uses: softprops/action-gh-release@v2
6852
with:

.github/workflows/snapshot.yml

Lines changed: 12 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,14 @@ jobs:
1616
fetch-depth: 0
1717
- uses: actions/setup-node@v4
1818
with:
19-
node-version: 22
19+
node-version: 24
20+
cache: 'npm'
21+
cache-dependency-path: frontend/package-lock.json
2022
- uses: actions/setup-go@v5
2123
with:
22-
go-version: 1.25.4
23-
- name: npm cache download
24-
uses: actions/cache/restore@v4
25-
with:
26-
path: ${{ github.workspace }}/frontend/node_modules
27-
key: npm-cache
28-
- name: go cache download
29-
uses: actions/cache/restore@v4
30-
with:
31-
path: ${{ github.workspace }}/.go
32-
key: go-cache
24+
go-version: 1.25.5
25+
cache: true
26+
cache-dependency-path: "**/go.sum"
3327
- name: Lint
3428
run: make check
3529
- name: Sonarqube
@@ -46,10 +40,14 @@ jobs:
4640
- uses: actions/checkout@v5
4741
- uses: actions/setup-node@v4
4842
with:
49-
node-version: 22
43+
node-version: 24
44+
cache: 'npm'
45+
cache-dependency-path: frontend/package-lock.json
5046
- uses: actions/setup-go@v5
5147
with:
52-
go-version: 1.25.4
48+
go-version: 1.25.5
49+
cache: true
50+
cache-dependency-path: "**/go.sum"
5351
- name: Install nfpm
5452
run: |
5553
echo 'deb [trusted=yes] https://repo.goreleaser.com/apt/ /' | sudo tee /etc/apt/sources.list.d/goreleaser.list
@@ -67,16 +65,6 @@ jobs:
6765
with:
6866
username: ${{ secrets.DOCKERHUB_USERNAME }}
6967
password: ${{ secrets.DOCKERHUB_TOKEN }}
70-
- name: npm cache download
71-
uses: actions/cache/restore@v4
72-
with:
73-
path: ${{ github.workspace }}/frontend/node_modules
74-
key: npm-cache
75-
- name: go cache download
76-
uses: actions/cache/restore@v4
77-
with:
78-
path: ${{ github.workspace }}/.go
79-
key: go-cache
8068
- name: Build and release
8169
env:
8270
GOPATH: ${{ github.workspace }}/.go
@@ -95,13 +83,3 @@ jobs:
9583
build/nginx-ignition*.apk
9684
build/nginx-ignition*.pkg.tar.zst
9785
build/nginx-ignition*.ipk
98-
- name: npm cache upload
99-
uses: actions/cache/save@v4
100-
with:
101-
path: ${{ github.workspace }}/frontend/node_modules
102-
key: npm-cache
103-
- name: go cache upload
104-
uses: actions/cache/save@v4
105-
with:
106-
path: ${{ github.workspace }}/.go
107-
key: go-cache

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ The nginx ignition is a user interface for the nginx web server, aimed at develo
99
want to manage configuration files manually for their use-cases.
1010

1111
Although it isn't the goal to be feature-complete (if your use-case is quite advanced or complex, you probably will not
12-
use a UI anyway), the project does aim to provide an intuitive and powerful way to configure and run nginx.
12+
use a UI anyway) or to be enterprise-ready, the project does aim to provide an intuitive and powerful way to configure
13+
and run nginx.
1314

1415
Some of the available features include:
1516
- Multiple nginx virtual hosts, each one with its customized set of domains, routes and bindings (port listeners)

api/accesslist/create_handler.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"github.com/gin-gonic/gin"
77
"github.com/google/uuid"
88

9+
"dillmann.com.br/nginx-ignition/api/common/converter"
910
"dillmann.com.br/nginx-ignition/core/accesslist"
1011
)
1112

@@ -19,7 +20,7 @@ func (h createHandler) handle(ctx *gin.Context) {
1920
panic(err)
2021
}
2122

22-
domainModel := toDomain(payload)
23+
domainModel := converter.Wrap(toDomain, payload)
2324
domainModel.ID = uuid.New()
2425

2526
if err := h.commands.Save(ctx.Request.Context(), domainModel); err != nil {

api/accesslist/update_handler.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"github.com/gin-gonic/gin"
77
"github.com/google/uuid"
88

9+
"dillmann.com.br/nginx-ignition/api/common/converter"
910
"dillmann.com.br/nginx-ignition/core/accesslist"
1011
)
1112

@@ -25,7 +26,7 @@ func (h updateHandler) handle(ctx *gin.Context) {
2526
return
2627
}
2728

28-
domainModel := toDomain(payload)
29+
domainModel := converter.Wrap(toDomain, payload)
2930
domainModel.ID = id
3031

3132
if err = h.commands.Save(ctx.Request.Context(), domainModel); err != nil {

api/certificate/issue_handler.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"github.com/gin-gonic/gin"
77

88
"dillmann.com.br/nginx-ignition/api/common/apierror"
9+
"dillmann.com.br/nginx-ignition/api/common/converter"
910
"dillmann.com.br/nginx-ignition/core/certificate"
1011
)
1112

@@ -19,7 +20,7 @@ func (h issueHandler) handle(ctx *gin.Context) {
1920
panic(err)
2021
}
2122

22-
domainModel := toIssueCertificateRequest(payload)
23+
domainModel := converter.Wrap(toIssueCertificateRequest, payload)
2324

2425
cert, err := h.commands.Issue(ctx.Request.Context(), domainModel)
2526
if apierror.CanHandle(err) {
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
package converter
2+
3+
import (
4+
"dillmann.com.br/nginx-ignition/core/common/coreerror"
5+
)
6+
7+
var badRequestErr = coreerror.New("One or more attributes were sent in an invalid format", true)
8+
9+
func Wrap[I any, O any](converter func(I) O, input I) O {
10+
return safeExecute(func() O {
11+
return converter(input)
12+
})
13+
}
14+
15+
func Wrap2[I1 any, I2 any, O any](converter func(I1, I2) O, input1 I1, input2 I2) O {
16+
return safeExecute(func() O {
17+
return converter(input1, input2)
18+
})
19+
}
20+
21+
func safeExecute[T any](action func() T) T {
22+
type result struct {
23+
value T
24+
err any
25+
}
26+
ch := make(chan result, 1)
27+
28+
go func() {
29+
defer func() {
30+
if err := recover(); err != nil {
31+
ch <- result{err: err}
32+
}
33+
}()
34+
35+
ch <- result{value: action()}
36+
}()
37+
38+
res := <-ch
39+
if res.err != nil {
40+
panic(badRequestErr)
41+
}
42+
43+
return res.value
44+
}

api/go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module dillmann.com.br/nginx-ignition/api
22

3-
go 1.25.4
3+
go 1.25.5
44

55
require (
66
github.com/gin-gonic/gin v1.11.0
@@ -20,7 +20,7 @@ require (
2020
github.com/go-playground/locales v0.14.1 // indirect
2121
github.com/go-playground/universal-translator v0.18.1 // indirect
2222
github.com/goccy/go-json v0.10.5 // indirect
23-
github.com/goccy/go-yaml v1.18.0 // indirect
23+
github.com/goccy/go-yaml v1.19.0 // indirect
2424
github.com/json-iterator/go v1.1.13-0.20220915233716-71ac16282d12 // indirect
2525
github.com/klauspost/cpuid/v2 v2.3.0 // indirect
2626
github.com/leodido/go-urn v1.4.0 // indirect
@@ -30,7 +30,7 @@ require (
3030
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
3131
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
3232
github.com/quic-go/qpack v0.6.0 // indirect
33-
github.com/quic-go/quic-go v0.57.0 // indirect
33+
github.com/quic-go/quic-go v0.57.1 // indirect
3434
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
3535
github.com/ugorji/go/codec v1.3.1 // indirect
3636
go.uber.org/mock v0.6.0 // indirect

api/host/create_handler.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"github.com/gin-gonic/gin"
77
"github.com/google/uuid"
88

9+
"dillmann.com.br/nginx-ignition/api/common/converter"
910
"dillmann.com.br/nginx-ignition/core/host"
1011
)
1112

@@ -19,7 +20,7 @@ func (h createHandler) handle(ctx *gin.Context) {
1920
panic(err)
2021
}
2122

22-
domainModel := toDomain(payload)
23+
domainModel := converter.Wrap(toDomain, payload)
2324
domainModel.ID = uuid.New()
2425

2526
if err := h.commands.Save(ctx.Request.Context(), domainModel); err != nil {

api/host/update_handler.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"github.com/gin-gonic/gin"
77
"github.com/google/uuid"
88

9+
"dillmann.com.br/nginx-ignition/api/common/converter"
910
"dillmann.com.br/nginx-ignition/core/host"
1011
)
1112

@@ -25,7 +26,7 @@ func (h updateHandler) handle(ctx *gin.Context) {
2526
return
2627
}
2728

28-
domainModel := toDomain(payload)
29+
domainModel := converter.Wrap(toDomain, payload)
2930
domainModel.ID = id
3031

3132
if err = h.commands.Save(ctx.Request.Context(), domainModel); err != nil {

0 commit comments

Comments
 (0)