Skip to content

Commit 140b4e1

Browse files
committed
2 parents 5520bcd + 9e6ed0e commit 140b4e1

55 files changed

Lines changed: 1917 additions & 795 deletions

Some content is hidden

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

.dockerignore

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,33 @@
1-
# Ignore all
2-
*
1+
# Env files
2+
**/*.env
33

4-
# env file
5-
*.env
4+
# Editor/IDE
5+
# .idea/
6+
.vscode/
67

78
# Git folders
89
.git*
9-
.github
10+
!.github
11+
12+
# Docusaurus
13+
.docusaurus
14+
node_modules
1015

1116
# Dev folders
1217
.dev
18+
dev-env.sh
1319
*.local.*
1420

15-
# Ignore yml files
16-
*.yaml
17-
*.yml
21+
# Editor config
22+
.editorconfig
1823

1924
# Markdown files
20-
*.md
25+
**/*.md
26+
27+
!LICENSE
2128

2229
# Include data/
2330
!data/*
2431

25-
# Ignore source files
26-
*.go
27-
go.mod
28-
go.sum
29-
30-
# Include build
31-
!app
32-
!dist/*
32+
# Include source files
33+
!*.go

.github/workflows/build-cmd.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build Image via Command
1+
name: Build & Push Image via Command
22

33
on:
44
workflow_dispatch:

.github/workflows/docker-image-dev.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ jobs:
114114
echo "COUNT=$COUNT" >> "$GITHUB_ENV"
115115
116116
- name: Login to Registry
117-
uses: docker/login-action@v3
117+
uses: docker/login-action@v4
118118
with:
119119
registry: ghcr.io
120120
username: ${{ github.repository_owner }}

.github/workflows/image-cleanup.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ jobs:
1818
name: Untagged Images
1919
with:
2020
registry: ghcr.io
21+
cleanup-stales: pr-*,ci-*,*-dev
2122
secrets:
2223
GH_PCKG_TOKEN: ${{ secrets.GH_PCKG_TOKEN }}

.gitignore

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,5 @@
1-
# Binaries for programs and plugins
2-
*.exe
3-
*.exe~
4-
*.dll
5-
*.so
6-
*.dylib
7-
8-
# Test binary, built with `go test -c`
9-
*.test
10-
11-
# Code coverage profiles and other test artifacts
12-
*.out
13-
coverage.*
14-
*.coverprofile
15-
profile.cov
16-
17-
# Dependency directories (remove the comment below to include it)
18-
# vendor/
19-
20-
# Go workspace file
21-
go.work
22-
go.work.sum
23-
24-
# env file
25-
*.env
1+
# Env files
2+
**/*.env
263

274
# Editor/IDE
285
# .idea/

Dockerfile

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,40 @@
1+
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.26-alpine AS builder
2+
3+
ARG TARGETOS
4+
ARG TARGETARCH
5+
6+
WORKDIR /app
7+
8+
COPY go.mod go.sum ./
9+
RUN go mod download
10+
11+
COPY . .
12+
13+
RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} \
14+
go build -ldflags="-s -w" -o /app/app .
15+
116
FROM alpine:3.22
17+
218
RUN apk --no-cache add ca-certificates
319

420
ARG IMAGE_TAG
521
ENV IMAGE_TAG=$IMAGE_TAG
622
LABEL org.opencontainers.image.version=$IMAGE_TAG
723

8-
ENV SERVICE__PORT=8880
9-
1024
ENV DEFAULTS_PATH=/app/data/defaults.yml
1125
ENV FAVICON_PATH=/app/data/favicon.ico
1226

1327
ENV CONFIG_PATH=/config/config.yml
1428
ENV TOKENS_DIR=/config/tokens
1529

16-
ENV DB_PATH=/db/db.sqlite3
17-
18-
ENV CGO_ENABLED=1
30+
ENV DB_PATH=/db/db.sqlite
1931

20-
ARG TARGETOS
21-
ARG TARGETARCH
32+
ENV REDACT_TOKENS=true
2233

2334
WORKDIR /app
2435

25-
COPY . .
26-
27-
COPY dist/${TARGETOS}/${TARGETARCH}/app .
36+
COPY --from=builder /app/app .
2837

29-
RUN rm dist/ -r
38+
COPY data/ /app/data/
3039

3140
CMD ["./app"]

data/defaults.yml

Lines changed: 38 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,44 @@ settings:
2929
{ field: data, score: 1 },
3030
]
3131

32-
variables:
33-
recipients: ${RECIPIENTS}
34-
number: ${NUMBER}
32+
scheduling:
33+
enabled: true
34+
35+
templating:
36+
body: true
37+
path: true
38+
query: true
39+
40+
injecting:
41+
urlToBody:
42+
query: true
43+
path: true
3544

3645
access:
3746
endpoints:
38-
- "!/v1/configuration"
39-
- "!/v1/devices"
40-
- "!/v1/register"
41-
- "!/v1/unregister"
42-
- "!/v1/qrcodelink"
43-
- "!/v1/accounts"
44-
- "!/v1/contacts"
47+
blocked:
48+
- pattern: /v1/configuration
49+
matchType: prefix
50+
- pattern: /v1/devices
51+
matchType: prefix
52+
- pattern: /v1/register
53+
matchType: prefix
54+
- pattern: /v1/unregister
55+
matchType: prefix
56+
- pattern: /v1/qrcodelink
57+
matchType: prefix
58+
- pattern: /v1/accounts
59+
matchType: prefix
60+
- pattern: /v1/contacts
61+
matchType: prefix
62+
63+
cors:
64+
methods: [GET, POST, PUT, PATCH, DELETE, OPTIONS]
65+
headers:
66+
[
67+
"Content-Type",
68+
"Content-Language",
69+
"Authorization",
70+
"Accept",
71+
"Accept-Language",
72+
]

dev-env.sh

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,29 @@
11
#!/usr/bin/env bash
22

3-
###############################################################################
4-
# This file is version-controlled and shared across developers.
3+
#═══════════════════════════════════════════════════════════════════════════════#
4+
# DEVELOPMENT ENVIRONMENT #
5+
#═══════════════════════════════════════════════════════════════════════════════#
56
#
6-
# It is used for setting up a developer environment for local testing.
7+
# Purpose:
8+
# Base environment configuration for local development and testing.
9+
# This file is shared and version-controlled across all developers.
710
#
8-
# Additionally overrides can be specified in dev-env.local.sh or dev.local.env.
9-
# Local environment variables may be added in dev.local.env.
11+
# Overrides (not committed):
12+
# - dev-env.local.sh → shell overrides / custom logic
13+
# - dev.local.env → machine-specific environment variables
1014
#
11-
# To successfully load the environment variables this file needs to be sourced.
15+
# Usage:
16+
# This file must be sourced to take effect:
17+
# source dev-env.sh
1218
#
13-
# Do not commit secrets or machine-specific values.
14-
###############################################################################
19+
# Guidelines:
20+
# - DO NOT add secrets or sensitive data here
21+
# - DO NOT add machine-specific values
22+
# - Use the override files for local customization
23+
#
24+
#═══════════════════════════════════════════════════════════════════════════════#
1525

26+
# ANSI codes
1627
RED='\033[0;31m'
1728
GREEN='\033[0;32m'
1829
YELLOW='\033[1;33m'
@@ -41,9 +52,7 @@ export DEFAULTS_PATH=$DIR/data/defaults.yml
4152
export FAVICON_PATH=$DIR/data/favicon.ico
4253
export CONFIG_PATH=$DIR/.dev/config.yml
4354
export TOKENS_DIR=$DIR/.dev/tokens
44-
export DB_PATH=$DIR/.dev/db/db.sqlite3
45-
46-
export CGO_ENABLED=1
55+
export DB_PATH=$DIR/.dev/db/db.sqlite
4756

4857
export API_URL=http://127.0.0.1:8881
4958

go.mod

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,52 @@
11
module github.com/codeshelldev/secured-signal-api
22

3-
go 1.25.6
3+
go 1.26.1
44

55
require (
6-
github.com/codeshelldev/gotl/pkg/configutils v0.0.16
6+
github.com/codeshelldev/gotl/pkg/configutils v0.0.23
77
github.com/codeshelldev/gotl/pkg/docker v0.0.2
8-
github.com/codeshelldev/gotl/pkg/ioutils v0.0.2
98
github.com/codeshelldev/gotl/pkg/jsonutils v0.0.2
10-
github.com/codeshelldev/gotl/pkg/logger v0.0.8
9+
github.com/codeshelldev/gotl/pkg/logger v0.0.18
1110
github.com/codeshelldev/gotl/pkg/pretty v0.0.10
1211
github.com/codeshelldev/gotl/pkg/query v0.0.4
13-
github.com/codeshelldev/gotl/pkg/request v0.0.8
12+
github.com/codeshelldev/gotl/pkg/request v0.0.10
1413
github.com/codeshelldev/gotl/pkg/scheduler v0.0.9
1514
github.com/codeshelldev/gotl/pkg/server/http v0.0.3
1615
github.com/codeshelldev/gotl/pkg/stringutils v0.0.8
17-
github.com/codeshelldev/gotl/pkg/templating v0.0.4
16+
github.com/codeshelldev/gotl/pkg/templating v0.0.16
1817
)
1918

2019
require (
20+
github.com/go-viper/mapstructure/v2 v2.5.0
2121
github.com/knadh/koanf/parsers/yaml v1.1.0
2222
golang.org/x/time v0.15.0
23+
modernc.org/sqlite v1.48.0
2324
)
2425

2526
require (
26-
github.com/clipperhouse/uax29/v2 v2.6.0 // indirect
27+
github.com/dustin/go-humanize v1.0.1 // indirect
28+
github.com/mattn/go-isatty v0.0.20 // indirect
29+
github.com/ncruces/go-strftime v1.0.0 // indirect
30+
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
31+
modernc.org/libc v1.70.0 // indirect
32+
modernc.org/mathutil v1.7.1 // indirect
33+
modernc.org/memory v1.11.0 // indirect
34+
)
35+
36+
require (
37+
github.com/clipperhouse/uax29/v2 v2.7.0 // indirect
2738
github.com/fsnotify/fsnotify v1.9.0 // indirect
28-
github.com/go-viper/mapstructure/v2 v2.5.0 // indirect
2939
github.com/google/uuid v1.6.0
3040
github.com/knadh/koanf/maps v0.1.2 // indirect
3141
github.com/knadh/koanf/providers/confmap v1.0.0 // indirect
3242
github.com/knadh/koanf/providers/env/v2 v2.0.0 // indirect
3343
github.com/knadh/koanf/providers/file v1.2.1 // indirect
34-
github.com/knadh/koanf/v2 v2.3.2 // indirect
35-
github.com/mattn/go-runewidth v0.0.19 // indirect
36-
github.com/mattn/go-sqlite3 v1.14.34
44+
github.com/knadh/koanf/v2 v2.3.4 // indirect
45+
github.com/mattn/go-runewidth v0.0.21 // indirect
3746
github.com/mitchellh/copystructure v1.2.0 // indirect
3847
github.com/mitchellh/reflectwalk v1.0.2 // indirect
3948
go.uber.org/multierr v1.11.0 // indirect
4049
go.uber.org/zap v1.27.1 // indirect
4150
go.yaml.in/yaml/v3 v3.0.4 // indirect
42-
golang.org/x/sys v0.41.0 // indirect
51+
golang.org/x/sys v0.42.0 // indirect
4352
)

0 commit comments

Comments
 (0)