Compare commits

...

13 Commits

32 changed files with 5398 additions and 6504 deletions

View File

@ -5,4 +5,5 @@
/bin
/misc/docker/Dockerfile
/.env
/.env.dist
/.env.dist
/tools

4
.gitignore vendored
View File

@ -3,4 +3,6 @@
/vendor
/bin
/node_modules
/.env
/.env
/tools
.mktools/

1
.nvmrc Normal file
View File

@ -0,0 +1 @@
v20.11.1

View File

@ -1,9 +1,20 @@
DOCKER_DATE_TAG := $(shell date +%Y%m%d%H%M)
DOCKER_REPOSITORY ?= reg.cadoles.com/cadoles
YQ_VERSION ?= v4.30.4
YQ_BINARY ?= yq_linux_amd64
tools: tools/yq/bin/yq
tools/yq/bin/yq:
mkdir -p tools/yq/bin
wget https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/${YQ_BINARY} -O tools/yq/bin/yq &&\
chmod +x tools/yq/bin/yq
build:
CGO_ENABLED=0 go build -v -o bin/fake-smtp ./cmd/fake-smtp
docker-image:
git tag -a $(MKT_PROJECT_VERSION) -m "v$(MKT_PROJECT_VERSION)" || exit 0
docker build \
--build-arg HTTP_PROXY=$(HTTP_PROXY) \
--build-arg HTTPS_PROXY=$(HTTPS_PROXY) \
@ -21,17 +32,20 @@ docker-run:
--tmpfs /app/data \
fake-smtp:latest
docker-release:
docker tag fake-smtp:latest bornholm/fake-smtp:latest
docker tag fake-smtp:latest bornholm/fake-smtp:$(DOCKER_DATE_TAG)
docker login
docker push bornholm/fake-smtp:latest
docker push bornholm/fake-smtp:$(DOCKER_DATE_TAG)
docker-release: .mktools
docker tag fake-smtp:latest $(DOCKER_REPOSITORY)/fake-smtp:$(MKT_PROJECT_VERSION)
docker tag fake-smtp:latest $(DOCKER_REPOSITORY)/fake-smtp:$(MKT_PROJECT_SHORT_VERSION)
docker tag fake-smtp:latest $(DOCKER_REPOSITORY)/fake-smtp:$(MKT_PROJECT_VERSION_CHANNEL)-latest
docker tag fake-smtp:latest $(DOCKER_REPOSITORY)/fake-smtp:$(MKT_PROJECT_SHORT_VERSION_CHANNEL)-latest
docker push $(DOCKER_REPOSITORY)/fake-smtp:$(MKT_PROJECT_VERSION)
docker push $(DOCKER_REPOSITORY)/fake-smtp:$(MKT_PROJECT_SHORT_VERSION)
docker push $(DOCKER_REPOSITORY)/fake-smtp:$(MKT_PROJECT_VERSION_CHANNEL)-latest
docker push $(DOCKER_REPOSITORY)/fake-smtp:$(MKT_PROJECT_SHORT_VERSION_CHANNEL)-latest
test:
go test -v -race ./...
release: dist
release: dist tools
@./misc/script/release.sh
dist:
@ -41,7 +55,7 @@ tidy:
go mod tidy
watch:
modd
go run github.com/cortesi/modd/cmd/modd@v0.8.1
lint:
golangci-lint run --enable-all
@ -55,4 +69,14 @@ clean:
rm -rf vendor
rm -rf bin
.PHONY: mktools
mktools:
rm -rf .mktools
curl -q https://forge.cadoles.com/Cadoles/mktools/raw/branch/master/install.sh | $(SHELL)
.mktools:
$(MAKE) mktools
-include .mktools/*.mk
.PHONY: lint watch build vendor tidy release

View File

@ -11,7 +11,7 @@ Serveur SMTP factice pour le développement avec interface web.
### Avec Docker
```bash
docker run -it --rm -p 8080:8080 -p 2525:2525 bornholm/fake-smtp
docker run -it --rm -p 8080:8080 -p 2525:2525 reg.cadoles.com/cadoles/fake-smtp
```
L'interface Web sera accessible à l'adresse http://localhost:8080/.
@ -58,15 +58,15 @@ data:
# Configuration du relais SMTP
relay:
enabled: false # Activer/désactiver le relais SMTP
address: "" # Adresse du serveur au format "host:port"
identity: "" # Identité du compte utilisateur, peut être laissé vide
username: "" # Identifiant du compte SMTP, non utilisé sur anonymous = true
password: "" # Mot de passe du compte SMTP, non utilisé sur anonymous = true
anonymous: false # Utiliser le mode d'authentification "anonyme"
useTLS: false # Utiliser TLS pour se connecter au serveur SMTP
insecureSkipVerify: true # Ne pas vérifier le certificat du serveur pour les connexions TLS/STARTTLS
fromOverride: "" # Surcharger l'adresse émetteur des courriels transmis
enabled: false # Activer/désactiver le relais SMTP
address: "" # Adresse du serveur au format "host:port"
identity: "" # Identité du compte utilisateur, peut être laissé vide
username: "" # Identifiant du compte SMTP, non utilisé sur anonymous = true
password: "" # Mot de passe du compte SMTP, non utilisé sur anonymous = true
anonymous: false # Utiliser le mode d'authentification "anonyme"
useTLS: false # Utiliser TLS pour se connecter au serveur SMTP
insecureSkipVerify: true # Ne pas vérifier le certificat du serveur pour les connexions TLS/STARTTLS
fromOverride: "" # Surcharger l'adresse émetteur des courriels transmis
```
### Variables d'environnement
@ -75,36 +75,36 @@ La configuration de FakeSMTP peut être personnalisée via des variables d'envir
Les valeurs des variables d'environnement surchargent les valeurs présentes dans le fichier de configuration.
|Variable|Correspondance dans le fichier de configuration|
|--------|-----------------------------------------------|
|`FAKESMTP_HTTP_ADDRESS`|`http.address`|
|`FAKESMTP_HTTP_TEMPLATEDIR`|`http.templateDir`|
|`FAKESMTP_HTTP_PUBLICDIR`|`http.publicDir`|
|`FAKESMTP_SMTP_ADDRESS`|`smtp.address`|
|`FAKESMTP_SMTP_USERNAME`|`smtp.username`|
|`FAKESMTP_SMTP_PASSWORD`|`smtp.password`|
|`FAKESMTP_SMTP_DOMAIN`|`smtp.domain`|
|`FAKESMTP_SMTP_READTIMEOUT`|`smtp.readTimeout`|
|`FAKESMTP_SMTP_WRITETIMEOUT`|`smtp.writeTimeout`|
|`FAKESMTP_SMTP_MAXMESSAGEBYTES`|`smtp.maxMessageBytes`|
|`FAKESMTP_SMTP_MAXRECIPIENTS`|`smtp.maxRecipients`|
|`FAKESMTP_SMTP_ALLOWINSECUREAUTH`|`smtp.allowInsecureAuth`|
|`FAKESMTP_SMTP_DEBUG`|`smtp.debug`|
|`FAKESMTP_DATA_PATH`|`data.path`|
|`FAKESMTP_RELAY_ENABLED`|`relay.enabled`|
|`FAKESMTP_RELAY_ADDRESS`|`relay.address`|
|`FAKESMTP_RELAY_IDENTITY`|`relay.identity`|
|`FAKESMTP_RELAY_USERNAME`|`relay.username`|
|`FAKESMTP_RELAY_PASSWORD`|`relay.password`|
|`FAKESMTP_RELAY_ANONYMOUS`|`relay.anonymous`|
|`FAKESMTP_RELAY_INSECURE_SKIP_VERIFY`|`relay.insecureSkipVerify`|
|`FAKESMTP_RELAY_FROM_OVERRIDE`|`relay.fromOverride`|
| Variable | Correspondance dans le fichier de configuration |
| ------------------------------------- | ----------------------------------------------- |
| `FAKESMTP_HTTP_ADDRESS` | `http.address` |
| `FAKESMTP_HTTP_TEMPLATEDIR` | `http.templateDir` |
| `FAKESMTP_HTTP_PUBLICDIR` | `http.publicDir` |
| `FAKESMTP_SMTP_ADDRESS` | `smtp.address` |
| `FAKESMTP_SMTP_USERNAME` | `smtp.username` |
| `FAKESMTP_SMTP_PASSWORD` | `smtp.password` |
| `FAKESMTP_SMTP_DOMAIN` | `smtp.domain` |
| `FAKESMTP_SMTP_READTIMEOUT` | `smtp.readTimeout` |
| `FAKESMTP_SMTP_WRITETIMEOUT` | `smtp.writeTimeout` |
| `FAKESMTP_SMTP_MAXMESSAGEBYTES` | `smtp.maxMessageBytes` |
| `FAKESMTP_SMTP_MAXRECIPIENTS` | `smtp.maxRecipients` |
| `FAKESMTP_SMTP_ALLOWINSECUREAUTH` | `smtp.allowInsecureAuth` |
| `FAKESMTP_SMTP_DEBUG` | `smtp.debug` |
| `FAKESMTP_DATA_PATH` | `data.path` |
| `FAKESMTP_RELAY_ENABLED` | `relay.enabled` |
| `FAKESMTP_RELAY_ADDRESS` | `relay.address` |
| `FAKESMTP_RELAY_IDENTITY` | `relay.identity` |
| `FAKESMTP_RELAY_USERNAME` | `relay.username` |
| `FAKESMTP_RELAY_PASSWORD` | `relay.password` |
| `FAKESMTP_RELAY_ANONYMOUS` | `relay.anonymous` |
| `FAKESMTP_RELAY_INSECURE_SKIP_VERIFY` | `relay.insecureSkipVerify` |
| `FAKESMTP_RELAY_FROM_OVERRIDE` | `relay.fromOverride` |
## Démarrer avec les sources
### Dépendances
- Go 1.13
- Go 1.21
- modd
- make
- NodeJS/npm
@ -128,4 +128,4 @@ make release
## Licence
AGPL-3.0
AGPL-3.0

View File

@ -3,10 +3,10 @@ package main
import (
"gitlab.com/wpetit/goweb/template/html"
"forge.cadoles.com/wpetit/fake-smtp/internal/command"
"forge.cadoles.com/wpetit/fake-smtp/internal/config"
"forge.cadoles.com/wpetit/fake-smtp/internal/query"
"forge.cadoles.com/wpetit/fake-smtp/internal/storm"
"forge.cadoles.com/Cadoles/fake-smtp/internal/command"
"forge.cadoles.com/Cadoles/fake-smtp/internal/config"
"forge.cadoles.com/Cadoles/fake-smtp/internal/query"
"forge.cadoles.com/Cadoles/fake-smtp/internal/storm"
"gitlab.com/wpetit/goweb/cqrs"
"gitlab.com/wpetit/goweb/service"
"gitlab.com/wpetit/goweb/service/build"

View File

@ -3,9 +3,9 @@ package main
import (
"net/http"
"forge.cadoles.com/wpetit/fake-smtp/internal/route"
"github.com/go-chi/chi"
"github.com/go-chi/chi/middleware"
"forge.cadoles.com/Cadoles/fake-smtp/internal/route"
"github.com/go-chi/chi/v5"
"github.com/go-chi/chi/v5/middleware"
"gitlab.com/wpetit/goweb/middleware/container"
"flag"
@ -14,11 +14,11 @@ import (
"os"
"forge.cadoles.com/wpetit/fake-smtp/internal/config"
"forge.cadoles.com/Cadoles/fake-smtp/internal/config"
"github.com/pkg/errors"
)
//nolint: gochecknoglobals
// nolint: gochecknoglobals
var (
configFile = ""
workdir = ""
@ -33,7 +33,7 @@ var (
BuildDate = "unknown"
)
//nolint: gochecknoinits
// nolint: gochecknoinits
func init() {
flag.StringVar(&configFile, "config", configFile, "configuration file")
flag.StringVar(&workdir, "workdir", workdir, "working directory")

View File

@ -6,8 +6,8 @@ import (
"log"
"os"
"forge.cadoles.com/wpetit/fake-smtp/internal/command"
"forge.cadoles.com/wpetit/fake-smtp/internal/config"
"forge.cadoles.com/Cadoles/fake-smtp/internal/command"
"forge.cadoles.com/Cadoles/fake-smtp/internal/config"
"github.com/emersion/go-smtp"
"github.com/jhillyerd/enmime"
"github.com/pkg/errors"

View File

@ -5,6 +5,6 @@
Date de construction: {{ .BuildInfo.BuildDate }}
</p>
<p class="has-text-right is-size-7 has-text-grey">
Propulsé par <a target="_blank" href="https://forge.cadoles.com/wpetit/fake-smtp">FakeSMTP</a> et publié sous licence <a href="https://www.gnu.org/licenses/agpl-3.0.txt">AGPL-3.0</a>.
Propulsé par <a target="_blank" href="https://forge.cadoles.com/Cadoles/fake-smtp">FakeSMTP</a> et publié sous licence <a href="https://www.gnu.org/licenses/agpl-3.0.txt">AGPL-3.0</a>.
</p>
{{end}}

43
go.mod
View File

@ -1,19 +1,52 @@
module forge.cadoles.com/wpetit/fake-smtp
module forge.cadoles.com/Cadoles/fake-smtp
go 1.14
go 1.21
require (
github.com/asdine/storm/v3 v3.1.1
github.com/caarlos0/env/v6 v6.2.1
github.com/emersion/go-sasl v0.0.0-20200509203442-7bfe0ed36a21
github.com/emersion/go-smtp v0.12.1
github.com/go-chi/chi v4.1.1+incompatible
github.com/go-chi/chi/v5 v5.0.12
github.com/jhillyerd/enmime v0.8.0
github.com/microcosm-cc/bluemonday v1.0.2
github.com/microcosm-cc/bluemonday v1.0.26
github.com/pkg/errors v0.9.1
gitlab.com/wpetit/goweb v0.0.0-20200707070104-985ce3eba3c2
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e // indirect
gopkg.in/yaml.v2 v2.2.8
)
require (
cdr.dev/slog v1.3.0 // indirect
github.com/alecthomas/chroma v0.7.0 // indirect
github.com/aymerick/douceur v0.2.0 // indirect
github.com/cention-sany/utf7 v0.0.0-20170124080048-26cad61bd60a // indirect
github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964 // indirect
github.com/dlclark/regexp2 v1.2.0 // indirect
github.com/fatih/color v1.7.0 // indirect
github.com/go-chi/chi v4.1.1+incompatible // indirect
github.com/go-playground/locales v0.12.1 // indirect
github.com/go-playground/universal-translator v0.16.0 // indirect
github.com/gogs/chardet v0.0.0-20150115103509-2404f7772561 // indirect
github.com/golang/groupcache v0.0.0-20191027212112-611e8accdfc9 // indirect
github.com/google/uuid v1.1.1 // indirect
github.com/gorilla/css v1.0.0 // indirect
github.com/jaytaylor/html2text v0.0.0-20190408195923-01ec452cbe43 // indirect
github.com/leodido/go-urn v1.1.0 // indirect
github.com/mattn/go-colorable v0.1.4 // indirect
github.com/mattn/go-isatty v0.0.11 // indirect
github.com/mattn/go-runewidth v0.0.4 // indirect
github.com/olekukonko/tablewriter v0.0.1 // indirect
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c // indirect
github.com/ssor/bom v0.0.0-20170718123548-6386211fdfcf // indirect
go.etcd.io/bbolt v1.3.4 // indirect
go.opencensus.io v0.22.2 // indirect
golang.org/x/crypto v0.20.0 // indirect
golang.org/x/net v0.21.0 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/term v0.17.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 // indirect
gopkg.in/go-playground/validator.v9 v9.29.1 // indirect
)
// replace gitlab.com/wpetit/goweb => ../goweb

28
go.sum
View File

@ -36,6 +36,8 @@ github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897 h1:p9Sln00KOTlrYkx
github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897/go.mod h1:xTS7Pm1pD1mvyM075QCDSRqH6qRLXylzS24ZTpRiSzQ=
github.com/asdine/storm/v3 v3.1.1 h1:5ESJvmcNhQQOFcvpxkIHcZs7mp8Z6XGdBqEoAgf+11g=
github.com/asdine/storm/v3 v3.1.1/go.mod h1:LEpXwGt4pIqrE/XcTvCnZHT5MgZCV6Ub9q7yQzOFWr0=
github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk=
github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4=
github.com/caarlos0/env/v6 v6.2.1 h1:/bFpX1dg4TNioJjg7mrQaSrBoQvRfLUHNfXivdFbbEo=
github.com/caarlos0/env/v6 v6.2.1/go.mod h1:3LpmfcAYCG6gCiSgDLaFR5Km1FRpPwFvBbRcjHar6Sw=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
@ -63,6 +65,8 @@ github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5Kwzbycv
github.com/go-chi/chi v4.0.2+incompatible/go.mod h1:eB3wogJHnLi3x/kFX2A+IbTBlXxmMeXJVKy9tTv1XzQ=
github.com/go-chi/chi v4.1.1+incompatible h1:MmTgB0R8Bt/jccxp+t6S/1VGIKdJw5J74CK/c9tTfA4=
github.com/go-chi/chi v4.1.1+incompatible/go.mod h1:eB3wogJHnLi3x/kFX2A+IbTBlXxmMeXJVKy9tTv1XzQ=
github.com/go-chi/chi/v5 v5.0.12 h1:9euLV5sTrTNTRUU9POmDUvfxyj6LAABLUcEWO+JJb4s=
github.com/go-chi/chi/v5 v5.0.12/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8=
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-playground/locales v0.12.1 h1:2FITxuFt/xuCNP1Acdhv62OzaCiviiE4kotfhkmOqEc=
github.com/go-playground/locales v0.12.1/go.mod h1:IUMDtCfWo/w/mtMfIE/IG2K+Ey3ygWanZIBtBW0W2TM=
@ -72,7 +76,6 @@ github.com/go-test/deep v1.0.2 h1:onZX1rnHT3Wv6cqNgYyFOOlgVKJrksuCMCRvJStbMYw=
github.com/go-test/deep v1.0.2/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA=
github.com/gogs/chardet v0.0.0-20150115103509-2404f7772561 h1:aBzukfDxQlCTVS0NBUjI5YA3iVeaZ9Tb5PxNrrIP1xs=
github.com/gogs/chardet v0.0.0-20150115103509-2404f7772561/go.mod h1:Pcatq5tYkCW2Q6yrR2VRHlbHpZ/R4/7qyL1TCF7vl14=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20191027212112-611e8accdfc9 h1:uHTyIjqVhYRhLbJ8nIiOJHkEZZ+5YoOsAbD3sk82NiE=
@ -101,6 +104,8 @@ github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
github.com/gorilla/csrf v1.6.0/go.mod h1:7tSf8kmjNYr7IWDCYhd3U8Ck34iQ/Yw5CJu7bAkHEGI=
github.com/gorilla/css v1.0.0 h1:BQqNyPTi50JCFMTw/b67hByjMVXZRwGha6wxVGkeihY=
github.com/gorilla/css v1.0.0/go.mod h1:Dn721qIggHpt4+EFCcTLTU/vk5ySda2ReITrtgBl60c=
github.com/gorilla/handlers v1.4.1/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ=
github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4=
@ -131,8 +136,8 @@ github.com/mattn/go-isatty v0.0.11 h1:FxPOTFNqGkuDUGi3H/qkUbQO4ZiBa2brKq5r0l8TGe
github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE=
github.com/mattn/go-runewidth v0.0.4 h1:2BvfKmzob6Bmd4YsL0zygOqfdFnK7GR4QL06Do4/p7Y=
github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
github.com/microcosm-cc/bluemonday v1.0.2 h1:5lPfLTTAvAbtS0VqT+94yOtFnGfUWYyx0+iToC3Os3s=
github.com/microcosm-cc/bluemonday v1.0.2/go.mod h1:iVP4YcDBq+n/5fb23BhYFvIMq/leAFZyRl6bYmGDlGc=
github.com/microcosm-cc/bluemonday v1.0.26 h1:xbqSvqzQMeEHCqMi64VAs4d8uy6Mequs3rQ0k/Khz58=
github.com/microcosm-cc/bluemonday v1.0.26/go.mod h1:JyzOCs9gkyQyjs+6h10UEVSe02CGwkhd72Xdqh78TWs=
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/nkovacs/streamquote v0.0.0-20170412213628-49af9bddb229/go.mod h1:0aYXnNPJ8l7uZxf45rWW1a/uME32OF0rhiYGNQ2oF2E=
github.com/olekukonko/tablewriter v0.0.1 h1:b3iUnf1v+ppJiOfNX4yxxqfWKMQPZR5yoh8urCTFX88=
@ -174,8 +179,9 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413 h1:ULYEB3JvPRE/IfO+9uO7vKV/xzVTO7XPAwm8xbf4w2g=
golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.20.0 h1:jmAMJJZXr5KiCw05dfYK9QnqaqKLYXijU23lsEdcQqg=
golang.org/x/crypto v0.20.0/go.mod h1:Xwo95rrVNIoSMx9wa1JroENMToLWn3RNVrTBpLHgZPQ=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
@ -196,7 +202,6 @@ golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKG
golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
@ -208,8 +213,8 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL
golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20191105084925-a882066a44e0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e h1:3G+cUijn7XD+S4eJFddp53Pv7+slrESplyjG25HgL+k=
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4=
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@ -231,12 +236,15 @@ golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191210023423-ac6580df4449/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.17.0 h1:mkTF7LCd6WGJNL3K1Ad7kwxNfYAW6a8a8QqtMblp/4U=
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=

View File

@ -5,8 +5,8 @@ import (
"github.com/pkg/errors"
"forge.cadoles.com/wpetit/fake-smtp/internal/model"
"forge.cadoles.com/wpetit/fake-smtp/internal/storm"
"forge.cadoles.com/Cadoles/fake-smtp/internal/model"
"forge.cadoles.com/Cadoles/fake-smtp/internal/storm"
"gitlab.com/wpetit/goweb/cqrs"
"gitlab.com/wpetit/goweb/middleware/container"
)

View File

@ -5,8 +5,8 @@ import (
"github.com/pkg/errors"
"forge.cadoles.com/wpetit/fake-smtp/internal/model"
"forge.cadoles.com/wpetit/fake-smtp/internal/storm"
"forge.cadoles.com/Cadoles/fake-smtp/internal/model"
"forge.cadoles.com/Cadoles/fake-smtp/internal/storm"
"gitlab.com/wpetit/goweb/cqrs"
"gitlab.com/wpetit/goweb/middleware/container"
)

View File

@ -10,7 +10,7 @@ import (
"github.com/emersion/go-smtp"
"forge.cadoles.com/wpetit/fake-smtp/internal/config"
"forge.cadoles.com/Cadoles/fake-smtp/internal/config"
"github.com/jhillyerd/enmime"
"github.com/pkg/errors"
"gitlab.com/wpetit/goweb/cqrs"

View File

@ -6,8 +6,8 @@ import (
"github.com/pkg/errors"
"forge.cadoles.com/wpetit/fake-smtp/internal/model"
"forge.cadoles.com/wpetit/fake-smtp/internal/storm"
"forge.cadoles.com/Cadoles/fake-smtp/internal/model"
"forge.cadoles.com/Cadoles/fake-smtp/internal/storm"
"github.com/jhillyerd/enmime"
"gitlab.com/wpetit/goweb/cqrs"
"gitlab.com/wpetit/goweb/middleware/container"

View File

@ -5,7 +5,7 @@ import (
"testing"
"time"
"forge.cadoles.com/wpetit/fake-smtp/internal/model"
"forge.cadoles.com/Cadoles/fake-smtp/internal/model"
"github.com/pkg/errors"
)

View File

@ -5,8 +5,8 @@ import (
"strings"
"time"
"forge.cadoles.com/wpetit/fake-smtp/internal/model"
"forge.cadoles.com/wpetit/fake-smtp/internal/storm"
"forge.cadoles.com/Cadoles/fake-smtp/internal/model"
"forge.cadoles.com/Cadoles/fake-smtp/internal/storm"
stormdb "github.com/asdine/storm/v3"
"github.com/asdine/storm/v3/q"
"github.com/pkg/errors"

View File

@ -3,8 +3,8 @@ package query
import (
"context"
"forge.cadoles.com/wpetit/fake-smtp/internal/model"
"forge.cadoles.com/wpetit/fake-smtp/internal/storm"
"forge.cadoles.com/Cadoles/fake-smtp/internal/model"
"forge.cadoles.com/Cadoles/fake-smtp/internal/storm"
"github.com/pkg/errors"
"gitlab.com/wpetit/goweb/cqrs"
"gitlab.com/wpetit/goweb/middleware/container"

View File

@ -3,8 +3,8 @@ package route
import (
"net/http"
"forge.cadoles.com/wpetit/fake-smtp/internal/query"
"forge.cadoles.com/wpetit/fake-smtp/internal/storm"
"forge.cadoles.com/Cadoles/fake-smtp/internal/query"
"forge.cadoles.com/Cadoles/fake-smtp/internal/storm"
"github.com/pkg/errors"
"gitlab.com/wpetit/goweb/api"
"gitlab.com/wpetit/goweb/cqrs"

View File

@ -7,11 +7,11 @@ import (
"github.com/microcosm-cc/bluemonday"
"forge.cadoles.com/wpetit/fake-smtp/internal/command"
"forge.cadoles.com/wpetit/fake-smtp/internal/model"
"forge.cadoles.com/wpetit/fake-smtp/internal/query"
"forge.cadoles.com/wpetit/fake-smtp/internal/storm"
"github.com/go-chi/chi"
"forge.cadoles.com/Cadoles/fake-smtp/internal/command"
"forge.cadoles.com/Cadoles/fake-smtp/internal/model"
"forge.cadoles.com/Cadoles/fake-smtp/internal/query"
"forge.cadoles.com/Cadoles/fake-smtp/internal/storm"
"github.com/go-chi/chi/v5"
"github.com/pkg/errors"
"gitlab.com/wpetit/goweb/cqrs"
"gitlab.com/wpetit/goweb/middleware/container"

View File

@ -6,8 +6,8 @@ import (
"strconv"
"time"
"forge.cadoles.com/wpetit/fake-smtp/internal/config"
"forge.cadoles.com/wpetit/fake-smtp/internal/query"
"forge.cadoles.com/Cadoles/fake-smtp/internal/config"
"forge.cadoles.com/Cadoles/fake-smtp/internal/query"
"github.com/pkg/errors"
"gitlab.com/wpetit/goweb/middleware/container"
"gitlab.com/wpetit/goweb/service"

View File

@ -3,8 +3,8 @@ package route
import (
"net/http"
"forge.cadoles.com/wpetit/fake-smtp/internal/command"
"forge.cadoles.com/wpetit/fake-smtp/internal/query"
"forge.cadoles.com/Cadoles/fake-smtp/internal/command"
"forge.cadoles.com/Cadoles/fake-smtp/internal/query"
"github.com/pkg/errors"
"gitlab.com/wpetit/goweb/cqrs"
"gitlab.com/wpetit/goweb/logger"

View File

@ -1,9 +1,9 @@
package route
import (
"forge.cadoles.com/wpetit/fake-smtp/internal/config"
"forge.cadoles.com/Cadoles/fake-smtp/internal/config"
"github.com/go-chi/chi"
"github.com/go-chi/chi/v5"
"gitlab.com/wpetit/goweb/static"
)

View File

@ -1,4 +1,4 @@
FROM golang:1.17 AS build
FROM reg.cadoles.com/proxy_cache/library/golang:1.21 AS build
ARG HTTP_PROXY=
ARG HTTPS_PROXY=
@ -7,28 +7,26 @@ ARG https_proxy=
RUN apt-get update && apt-get install -y build-essential git bash curl
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - \
RUN curl -sL https://deb.nodesource.com/setup_20.x | bash - \
&& apt-get install -y nodejs
COPY . /src
WORKDIR /src
RUN cp -f misc/docker/config-patch.yml misc/release/config-patch.yml
RUN go get github.com/krishicks/yaml-patch/cmd/yaml-patch
RUN npm install \
&& make vendor \
&& echo "---" > ./misc/release/config-patch.yml \
RUN cp -f misc/docker/config-patch.txt misc/release/config-patch.txt \
&& npm ci \
&& make ARCH_TARGETS=amd64 release
FROM busybox
FROM reg.cadoles.com/proxy_cache/library/busybox
RUN adduser -D -h /app fsmtp
COPY --from=build /src/release/fake-smtp-linux-amd64 /app
RUN chown -R fsmtp:fsmtp /app
EXPOSE 8080 2525
USER fsmtp
WORKDIR /app
RUN mkdir -p /app
CMD ["bin/fake-smtp", "--config", "config.yml"]

View File

@ -0,0 +1 @@
.smtp.debug = false

View File

@ -1,4 +0,0 @@
---
- op: replace
path: /smtp/debug
value: false

View File

@ -0,0 +1,3 @@
.data.path = "/var/lib/fake-smtp/data.db"
.smtp.address = "127.0.0.1:2525"
.smtp.debug = false

View File

@ -1,10 +0,0 @@
---
- op: replace
path: /data/path
value: /var/lib/fake-smtp/data.db
- op: replace
path: /smtp/address
value: 127.0.0.1:2525
- op: replace
path: /smtp/debug
value: false

View File

@ -73,13 +73,17 @@ function dump_default_conf {
local command=$1
local os=$2
local arch=$3
local tmp_conf=$(mktemp)
local patched_conf=$(mktemp)
go run "$PROJECT_DIR/cmd/$command" -dump-config > "$tmp_conf"
cat "$tmp_conf" | yaml-patch -o misc/release/config-patch.yml > "$patched_conf"
go run "$PROJECT_DIR/cmd/$command" -dump-config > "$patched_conf"
while IFS= read -r yq_cmd; do
echo "patching configuration with '$yq_cmd'..."
tools/yq/bin/yq -i "$yq_cmd" "$patched_conf"
done < misc/release/config-patch.txt
copy "$command" $os $arch "$patched_conf" "config.yml"
rm -f "$tmp_conf" "$patched_conf"
rm -f "$patched_conf"
}
function compress {

11547
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -11,21 +11,21 @@
"author": "William Petit <wpetit@cadoles.com>",
"license": "AGPL-3.0",
"devDependencies": {
"@babel/core": "^7.2.0",
"@babel/core": "^7.23.9",
"@babel/plugin-proposal-class-properties": "^7.2.1",
"@babel/preset-env": "^7.2.0",
"babel-loader": "^8.0.4",
"bulma": "^0.8.2",
"bulma-switch": "^2.0.0",
"css-loader": "^3.5.2",
"file-loader": "^6.0.0",
"mini-css-extract-plugin": "^0.9.0",
"node-sass": "^4.14.1",
"resolve-url-loader": "^3.0.0",
"sass-loader": "^8.0.2",
"stimulus": "^1.1.0",
"style-loader": "^1.1.4",
"webpack": "^4.25.0",
"webpack-cli": "^3.1.2"
"@babel/preset-env": "^7.23.9",
"babel-loader": "^9.1.3",
"bulma": "^0.9.4",
"bulma-switch": "^2.0.4",
"css-loader": "^6.10.0",
"file-loader": "^6.2.0",
"mini-css-extract-plugin": "^2.8.0",
"node-sass": "^9.0.0",
"resolve-url-loader": "^5.0.0",
"sass-loader": "^14.1.1",
"stimulus": "^3.2.2",
"style-loader": "^3.3.4",
"webpack": "^5.90.3",
"webpack-cli": "^5.1.4"
}
}

View File

@ -64,8 +64,8 @@ module.exports = {
},
plugins: [
new MiniCssExtractPlugin({
filename: "/css/[name].css",
chunkFilename: "/css/[id].css"
filename: "./css/[name].css",
chunkFilename: "./css/[id].css"
})
]
}