Skip to content

Commit 041fbff

Browse files
feat!: final rewrite
Rewritten with chi HTTP router, templ template library, htmx JS library, daisyUI CSS library. - Apprise endpoint - better HTTP error handling - tracing of actions - Web UI improvements - use Suture Go library instead of custom background library - use core.App interface for all actions - remove Bun ORM + Jet query builder for Jet query builer - migrations are now managed with atlas schema migration tool
1 parent b6e01a9 commit 041fbff

File tree

217 files changed

+14561
-6482
lines changed

Some content is hidden

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

217 files changed

+14561
-6482
lines changed

.air.toml

+7-7
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@ tmp_dir = "tmp"
44

55
[build]
66
args_bin = []
7-
bin = "./tmp/main"
8-
cmd = "go build -o ./tmp/main -tags dev ."
9-
delay = 1000 # ms
10-
exclude_dir = ["assets", "tmp", "vendor", "testdata"]
7+
bin = "./tmp/main -debug"
8+
cmd = "make gen-templ && go build -o ./tmp/main -tags dev ./cmd/smtpbridge"
9+
delay = 10 # ms
10+
exclude_dir = ["assets", "tmp", "vendor", "testdata", "smtpbridge_data"]
1111
exclude_file = []
12-
exclude_regex = ["_test.go"]
12+
exclude_regex = ["_test.go", ".*_templ.go"]
1313
exclude_unchanged = false
1414
follow_symlink = false
1515
full_bin = ""
1616
include_dir = []
17-
include_ext = ["go"]
17+
include_ext = ["go", "tpl", "tmpl", "html", "templ", "py"]
1818
include_file = []
19-
kill_delay = "1s"
19+
kill_delay = "0s"
2020
log = "build-errors.log"
2121
poll = false
2222
poll_interval = 0

.goreleaser.yaml

+8-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ before:
1111
# you may remove this if you don't need go generate
1212
- go generate ./...
1313
builds:
14-
- env:
14+
- main: ./cmd/smtpbridge
15+
env:
1516
- CGO_ENABLED=0
1617
goos:
1718
- linux
@@ -50,6 +51,8 @@ dockers:
5051
- --label=org.opencontainers.image.created={{ .Date }}
5152
- --label=org.opencontainers.image.revision={{ .FullCommit }}
5253
- --label=org.opencontainers.image.licenses={{ .Env.LICENSES }}
54+
extra_files:
55+
- entrypoint.sh
5356
- goarch: arm64
5457
image_templates:
5558
- ghcr.io/{{ .Env.REPO_OWNER }}/{{ .ProjectName }}:{{ .Version }}-arm64v8
@@ -66,6 +69,8 @@ dockers:
6669
- --label=org.opencontainers.image.created={{ .Date }}
6770
- --label=org.opencontainers.image.revision={{ .FullCommit }}
6871
- --label=org.opencontainers.image.licenses={{ .Env.LICENSES }}
72+
extra_files:
73+
- entrypoint.sh
6974
- goarch: arm
7075
goarm: 7
7176
image_templates:
@@ -83,6 +88,8 @@ dockers:
8388
- --label=org.opencontainers.image.created={{ .Date }}
8489
- --label=org.opencontainers.image.revision={{ .FullCommit }}
8590
- --label=org.opencontainers.image.licenses={{ .Env.LICENSES }}
91+
extra_files:
92+
- entrypoint.sh
8693
docker_manifests:
8794
- name_template: ghcr.io/{{ .Env.REPO_OWNER }}/{{ .ProjectName }}:{{ .Version }}
8895
image_templates:

Dockerfile

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
FROM alpine
22

3-
VOLUME /data
3+
ENV APPRISE_ENABLE=
4+
ENV APPRISE_VERSION=
45

6+
VOLUME /data
57
WORKDIR /config
68

7-
ENTRYPOINT ["/usr/bin/smtpbridge", "--data-directory=/data"]
9+
ENTRYPOINT ["/entrypoint.sh"]
810

11+
COPY entrypoint.sh /entrypoint.sh
912
COPY smtpbridge /usr/bin/smtpbridge

Makefile

+58-9
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,77 @@
1-
gen:
2-
jet -source=sqlite -dsn="./smtpbridge_data/smtpbridge.db" -path=./internal/dbgen -ignore-tables bun_migrations,bun_migration_locks
1+
export DB_DIR=./smtpbridge_data
2+
export DB_FILE=smtpbridge.db
3+
export DB_PATH="$(DB_DIR)/$(DB_FILE)"
4+
export DEV_IP=127.0.0.1
5+
6+
-include .env
37

48
snapshot:
59
goreleaser release --snapshot --clean
610

11+
run:
12+
go run ./cmd/smtpbridge
13+
714
preview:
8-
cd web && pnpm run build && cd .. && go run .
15+
cd web && pnpm run build && cd .. && go run ./cmd/smtpbridge
16+
17+
clean:
18+
rm -rf "$(DB_DIR)" && mkdir "$(DB_DIR)"
19+
20+
gen: db-migrate gen-jet gen-templ
21+
22+
dep: dep-air dep-jet dep-goose dep-atlas dep-templ dep-goreleaser
23+
24+
# Development
925

1026
dev:
1127
air
1228

1329
dev-web:
14-
cd web && pnpm run dev
30+
cd web && pnpm install && pnpm run dev
1531

16-
clean:
17-
rm -rf smtpbridge_data
32+
# Database
33+
34+
db-ui:
35+
podman run -it --rm \
36+
-p 8090:8080 \
37+
-v "$(DB_DIR):/data" \
38+
-e "SQLITE_DATABASE=$(DB_FILE)" \
39+
docker.io/coleifer/sqlite-web
1840

19-
dep: dep-air dep-jet dep-web
41+
db-inspect:
42+
atlas schema inspect --env local
43+
44+
db-migration:
45+
atlas migrate diff $(name) --env local
46+
47+
db-migrate:
48+
goose -dir migrations sqlite3 "$(DB_PATH)" up
49+
50+
# Generation
51+
52+
gen-jet:
53+
jet -source=sqlite -dsn="$(DB_PATH)" -path=./internal/jet -ignore-tables goose_db_version
54+
rm -rf ./internal/jet/model
55+
56+
gen-templ:
57+
cd web && templ generate
58+
59+
# Dependencies
2060

2161
dep-air:
2262
go install github.com/cosmtrek/air@latest
2363

2464
dep-jet:
2565
go install github.com/go-jet/jet/v2/cmd/jet@latest
2666

27-
dep-web:
28-
cd web && pnpm install
67+
dep-goose:
68+
go install github.com/pressly/goose/v3/cmd/goose@latest
69+
70+
dep-atlas:
71+
go install ariga.io/atlas/cmd/atlas@latest
72+
73+
dep-templ:
74+
go install github.com/a-h/templ/cmd/templ@latest
75+
76+
dep-goreleaser:
77+
go install github.com/goreleaser/goreleaser@latest

0 commit comments

Comments
 (0)