Compare commits
8 Commits
e89061540a
...
pkg/dev/ub
Author | SHA1 | Date | |
---|---|---|---|
2a3e7886d5 | |||
abef0a0b17 | |||
40b2689952 | |||
5647f731ab | |||
40cd15fa7e | |||
b52dbfe1ab | |||
c62f1e9c97 | |||
45ee2a0e3d |
@ -5,5 +5,4 @@
|
|||||||
/bin
|
/bin
|
||||||
/misc/docker/Dockerfile
|
/misc/docker/Dockerfile
|
||||||
/.env
|
/.env
|
||||||
/.env.dist
|
/.env.dist
|
||||||
/tools
|
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -3,5 +3,4 @@
|
|||||||
/vendor
|
/vendor
|
||||||
/bin
|
/bin
|
||||||
/node_modules
|
/node_modules
|
||||||
/.env
|
/.env
|
||||||
/tools
|
|
14
Makefile
14
Makefile
@ -1,14 +1,4 @@
|
|||||||
DOCKER_DATE_TAG := $(shell date --utc +%Y.%-m.%-d%-H%-M)
|
DOCKER_DATE_TAG := $(shell date +%Y%m%d%H%M)
|
||||||
|
|
||||||
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:
|
build:
|
||||||
CGO_ENABLED=0 go build -v -o bin/fake-smtp ./cmd/fake-smtp
|
CGO_ENABLED=0 go build -v -o bin/fake-smtp ./cmd/fake-smtp
|
||||||
@ -41,7 +31,7 @@ docker-release:
|
|||||||
test:
|
test:
|
||||||
go test -v -race ./...
|
go test -v -race ./...
|
||||||
|
|
||||||
release: dist tools
|
release: dist
|
||||||
@./misc/script/release.sh
|
@./misc/script/release.sh
|
||||||
|
|
||||||
dist:
|
dist:
|
||||||
|
20
README.md
20
README.md
@ -55,6 +55,18 @@ smtp:
|
|||||||
# Configuration du stockage
|
# Configuration du stockage
|
||||||
data:
|
data:
|
||||||
path: fakesmtp.db
|
path: fakesmtp.db
|
||||||
|
|
||||||
|
# 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
|
||||||
```
|
```
|
||||||
|
|
||||||
### Variables d'environnement
|
### Variables d'environnement
|
||||||
@ -79,6 +91,14 @@ Les valeurs des variables d'environnement surchargent les valeurs présentes dan
|
|||||||
|`FAKESMTP_SMTP_ALLOWINSECUREAUTH`|`smtp.allowInsecureAuth`|
|
|`FAKESMTP_SMTP_ALLOWINSECUREAUTH`|`smtp.allowInsecureAuth`|
|
||||||
|`FAKESMTP_SMTP_DEBUG`|`smtp.debug`|
|
|`FAKESMTP_SMTP_DEBUG`|`smtp.debug`|
|
||||||
|`FAKESMTP_DATA_PATH`|`data.path`|
|
|`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émarrer avec les sources
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
FROM golang:1.19 AS build
|
FROM golang:1.17 AS build
|
||||||
|
|
||||||
ARG HTTP_PROXY=
|
ARG HTTP_PROXY=
|
||||||
ARG HTTPS_PROXY=
|
ARG HTTPS_PROXY=
|
||||||
@ -14,8 +14,13 @@ COPY . /src
|
|||||||
|
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
|
|
||||||
RUN cp -f misc/docker/config-patch.txt misc/release/config-patch.txt \
|
RUN cp -f misc/docker/config-patch.yml misc/release/config-patch.yml
|
||||||
&& npm install \
|
|
||||||
|
RUN go get github.com/krishicks/yaml-patch/cmd/yaml-patch
|
||||||
|
|
||||||
|
RUN npm install \
|
||||||
|
&& make vendor \
|
||||||
|
&& echo "---" > ./misc/release/config-patch.yml \
|
||||||
&& make ARCH_TARGETS=amd64 release
|
&& make ARCH_TARGETS=amd64 release
|
||||||
|
|
||||||
FROM busybox
|
FROM busybox
|
||||||
@ -26,6 +31,4 @@ WORKDIR /app
|
|||||||
|
|
||||||
RUN mkdir -p /app
|
RUN mkdir -p /app
|
||||||
|
|
||||||
EXPOSE 8080 2525
|
|
||||||
|
|
||||||
CMD ["bin/fake-smtp", "--config", "config.yml"]
|
CMD ["bin/fake-smtp", "--config", "config.yml"]
|
@ -1 +0,0 @@
|
|||||||
.smtp.debug = false
|
|
4
misc/docker/config-patch.yml
Normal file
4
misc/docker/config-patch.yml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
- op: replace
|
||||||
|
path: /smtp/debug
|
||||||
|
value: false
|
@ -1,3 +0,0 @@
|
|||||||
.data.path = "/var/lib/fake-smtp/data.db"
|
|
||||||
.smtp.address = "127.0.0.1:2525"
|
|
||||||
.smtp.debug = false
|
|
10
misc/release/config-patch.yml
Normal file
10
misc/release/config-patch.yml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
- 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
|
@ -73,17 +73,13 @@ function dump_default_conf {
|
|||||||
local command=$1
|
local command=$1
|
||||||
local os=$2
|
local os=$2
|
||||||
local arch=$3
|
local arch=$3
|
||||||
|
local tmp_conf=$(mktemp)
|
||||||
local patched_conf=$(mktemp)
|
local patched_conf=$(mktemp)
|
||||||
|
|
||||||
go run "$PROJECT_DIR/cmd/$command" -dump-config > "$patched_conf"
|
go run "$PROJECT_DIR/cmd/$command" -dump-config > "$tmp_conf"
|
||||||
|
cat "$tmp_conf" | yaml-patch -o misc/release/config-patch.yml > "$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"
|
copy "$command" $os $arch "$patched_conf" "config.yml"
|
||||||
rm -f "$patched_conf"
|
rm -f "$tmp_conf" "$patched_conf"
|
||||||
}
|
}
|
||||||
|
|
||||||
function compress {
|
function compress {
|
||||||
|
Reference in New Issue
Block a user