notification dev env #367

Merged
tech merged 1 commits from notification-366 into main 2026-01-30 16:02:44 +00:00
8 changed files with 140 additions and 73 deletions

View File

@@ -1,57 +1,46 @@
# Config file for [Air](https://github.com/air-verse/air) in TOML format root = "."
testdata_dir = "testdata"
# Working directory
# . or absolute path, please note that the directories following must be under root.
root = "./.."
tmp_dir = "tmp" tmp_dir = "tmp"
[build] [build]
# Just plain old shell command. You could use `make` as well. args_bin = []
cmd = "go build -o app -ldflags \"-X 'github.com/tech/sendico/notification/internal/appversion.BuildUser=$(whoami)' -X 'github.com/tech/sendico/notification/internal/appversion.Version=$APP_V' -X 'github.com/tech/sendico/notification/internal/appversion.Branch=$BUILD_BRANCH' -X 'github.com/tech/sendico/notification/internal/appversion.Revision=$GIT_REV' -X 'github.com/tech/sendico/notification/internal/appversion.BuildDate=$(date)' -X 'github.com/tech/sendico/notification/internal/mutil/ampli.Version=$APP_V'\"" entrypoint = "./tmp/main"
# Binary file yields from `cmd`. cmd = "go build -o ./tmp/main ."
bin = "./app" delay = 1000
# Customize binary, can setup environment variables when run your app. exclude_dir = ["assets", "tmp", "vendor", "testdata"]
full_bin = "./app --debug" exclude_file = []
# Watch these filename extensions. exclude_regex = ["_test.go", "_templ.go"]
include_ext = ["go", "tpl", "tmpl", "html"] exclude_unchanged = false
# Ignore these filename extensions or directories. follow_symlink = false
exclude_dir = ["notification/.git", "pkg/.git", "notification/tmp", "notification/resources", "notification/env"] full_bin = ""
# Watch these directories if you specified. include_dir = []
include_dir = [] include_ext = ["go", "tpl", "tmpl", "html"]
# Watch these files. include_file = []
include_file = [] kill_delay = "0s"
# Exclude files. log = "build-errors.log"
exclude_file = [] poll = false
# Exclude specific regular expressions. poll_interval = 0
exclude_regex = ["_test\\.go"] post_cmd = []
# Exclude unchanged files. pre_cmd = []
exclude_unchanged = true rerun = false
# Follow symlink for directories rerun_delay = 500
follow_symlink = true send_interrupt = false
# This log file places in your tmp_dir. stop_on_error = false
log = "air.log"
# It's not necessary to trigger build each time file changes if it's too frequent.
delay = 0 # ms
# Stop running old binary when build errors occur.
stop_on_error = true
# Send Interrupt signal before killing process (windows does not support this feature)
send_interrupt = true
# Delay after sending Interrupt signal
kill_delay = 500 # ms
# Add additional arguments when running binary (bin/full_bin). Will run './tmp/main hello world'.
args_bin = []
[log]
# Show log time
time = false
[color] [color]
# Customize each part's color. If no color found, use the raw app log. app = ""
main = "magenta" build = "yellow"
watcher = "cyan" main = "magenta"
build = "yellow" runner = "green"
runner = "green" watcher = "cyan"
[log]
main_only = false
time = false
[misc] [misc]
# Delete tmp directory on exit clean_on_exit = false
clean_on_exit = true
[screen]
clear_on_rebuild = false
keep_scroll = true

View File

@@ -1,2 +1,4 @@
notification notification
.gocache .gocache
app
tmp

94
api/notification/config.dev.yml Executable file
View File

@@ -0,0 +1,94 @@
http_server:
listen_address: :8081
read_header_timeout: 60
shutdown_timeout: 5
api:
amplitude:
ampli_environment_env: AMPLI_ENVIRONMENT
middleware:
api_protocol_env: API_PROTOCOL
domain_env: SERVICE_HOST
api_endpoint_env: API_ENDPOINT
signature:
secret_key_env: API_ENDPOINT_SECRET
algorithm: HS256
CORS:
max_age: 300
allowed_origins:
- "http://*"
- "https://*"
allowed_methods:
- "GET"
- "POST"
- "PATCH"
- "DELETE"
- "OPTIONS"
allowed_headers:
- "Accept"
- "Authorization"
- "Content-Type"
exposed_headers:
allow_credentials: false
websocket:
endpoint_env: WS_ENDPOINT
timeout: 60
message_broker:
driver: NATS
settings:
url_env: NATS_URL
host_env: NATS_HOST
port_env: NATS_PORT
username_env: NATS_USER
password_env: NATS_PASSWORD
broker_name: Sendico Notification server
max_reconnects: 10
reconnect_wait: 5
buffer_size: 1024
# type: in-process
# settings:
# buffer_size: 10
notification:
driver: client
settings:
username_env: MAIL_USER
password_env: MAIL_SECRET
host: "mail.sendico.io"
port: 465
from: "Sendico Tech"
network_timeout: 10
telegram:
bot_token_env: TELEGRAM_BOT_TOKEN
chat_id_env: TELEGRAM_CHAT_ID
thread_id_env: TELEGRAM_THREAD_ID
api_url: "https://api.telegram.org"
timeout_seconds: 10
parse_mode: markdown
localizer:
path: "./i18n"
languages: ["en", "ru"]
service_name: "Sendico"
support: "support@sendico.io"
app:
database:
driver: mongodb
settings:
host_env: MONGO_HOST
port_env: MONGO_PORT
database_env: MONGO_DATABASE
user_env: MONGO_USER
password_env: MONGO_PASSWORD
auth_source_env: MONGO_AUTH_SOURCE
replica_set_env: MONGO_REPLICA_SET
enforcer:
driver: native
settings:
model_path_env: PERMISSION_MODEL
adapter:
collection_name_env: PERMISSION_COLLECTION
database_name_env: MONGO_DATABASE
timeout_seconds_env: PERMISSION_TIMEOUT
is_filtered_env: PERMISSION_IS_FILTERED

View File

@@ -1,6 +1,6 @@
module github.com/tech/sendico/notification module github.com/tech/sendico/notification
go 1.25.3 go 1.25.6
replace github.com/tech/sendico/pkg => ../pkg replace github.com/tech/sendico/pkg => ../pkg
@@ -52,7 +52,7 @@ require (
golang.org/x/net v0.49.0 // indirect golang.org/x/net v0.49.0 // indirect
golang.org/x/sync v0.19.0 // indirect golang.org/x/sync v0.19.0 // indirect
golang.org/x/sys v0.40.0 // indirect golang.org/x/sys v0.40.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20260122232226-8e98ce8d340d // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20260128011058-8636f8732409 // indirect
google.golang.org/grpc v1.78.0 // indirect google.golang.org/grpc v1.78.0 // indirect
google.golang.org/protobuf v1.36.11 // indirect google.golang.org/protobuf v1.36.11 // indirect
) )

View File

@@ -229,8 +229,8 @@ golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk= gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk=
gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E= gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E=
google.golang.org/genproto/googleapis/rpc v0.0.0-20260122232226-8e98ce8d340d h1:xXzuihhT3gL/ntduUZwHECzAn57E8dA6l8SOtYWdD8Q= google.golang.org/genproto/googleapis/rpc v0.0.0-20260128011058-8636f8732409 h1:H86B94AW+VfJWDqFeEbBPhEtHzJwJfTbgE2lZa54ZAQ=
google.golang.org/genproto/googleapis/rpc v0.0.0-20260122232226-8e98ce8d340d/go.mod h1:j9x/tPzZkyxcgEFkiKEEGxfvyumM01BEtsW8xzOahRQ= google.golang.org/genproto/googleapis/rpc v0.0.0-20260128011058-8636f8732409/go.mod h1:j9x/tPzZkyxcgEFkiKEEGxfvyumM01BEtsW8xzOahRQ=
google.golang.org/grpc v1.78.0 h1:K1XZG/yGDJnzMdd/uZHAkVqJE+xIDOcmdSFZkBUicNc= google.golang.org/grpc v1.78.0 h1:K1XZG/yGDJnzMdd/uZHAkVqJE+xIDOcmdSFZkBUicNc=
google.golang.org/grpc v1.78.0/go.mod h1:I47qjTo4OKbMkjA/aOOwxDIiPSBofUtQUI5EfpWvW7U= google.golang.org/grpc v1.78.0/go.mod h1:I47qjTo4OKbMkjA/aOOwxDIiPSBofUtQUI5EfpWvW7U=
google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE=

View File

@@ -25,15 +25,6 @@
"mail.email-changed.subj": "{{.ServiceName}}: your email address has been changed", "mail.email-changed.subj": "{{.ServiceName}}: your email address has been changed",
"mail.email-changed.greeting": "Hi, {{.Name}}", "mail.email-changed.greeting": "Hi, {{.Name}}",
"mail.email-changed.body": "You changed your email address to {{.NewEmail}}.<br><br>If you have not changed your email address please contact us under <a href=\"mailto:{{.SupportMail}}\">{{.SupportMail}}</a>", "mail.email-changed.body": "You changed your email address to {{.NewEmail}}.<br><br>If you have not changed your email address please contact us under <a href=\"mailto:{{.SupportMail}}\">{{.SupportMail}}</a>",
"mail.booking-confirmation.subj": "{{.ServiceName}}: your meeting confirmation",
"mail.booking-confirmation.greeting": "Hi, {{.Name}}",
"mail.booking-confirmation.body": "Your meeting time slot is confirmed on {{.Date}} at {{.Time}}.<br><br>Should you feel like rescheduling your meeting, follow this <a href=\"{{.URLReschedule}}\">link</a>.<br><br>If you want to cancel your meeting, click <a href=\"{{.URLCancel}}\">here</a>.",
"mail.booking-cancellation.subj": "{{.ServiceName}}: your meeting was cancelled",
"mail.booking-cancellation.greeting": "Hi, {{.Name}}",
"mail.booking-cancellation.body": "Your meeting on {{.Date}} at {{.Time}} was cancelled.",
"mail.booking-reschedule.subj": "{{.ServiceName}}: your meeting was rescheduled",
"mail.booking-reschedule.greeting": "Hi, {{.Name}}",
"mail.booking-reschedule.body": "Your meeting was rescheduled for a new time on {{.Date}} at {{.Time}}.<br><br>Should you feel like rescheduling your meeting again, follow this <a href=\"{{.URLReschedule}}\">link</a>.<br><br>If you want to cancel your meeting, click <a href=\"{{.URLCancel}}\">here</a>.",
"mail.template.privacy": "Privacy policy", "mail.template.privacy": "Privacy policy",
"mail.template.unsubscribe": "Unsubscribe", "mail.template.unsubscribe": "Unsubscribe",
"btn.verify": "Verify", "btn.verify": "Verify",

View File

@@ -25,15 +25,6 @@
"mail.email-changed.subj": "{{.ServiceName}}: ваш адрес изменен", "mail.email-changed.subj": "{{.ServiceName}}: ваш адрес изменен",
"mail.email-changed.greeting": "День добрый, {{.Name}}", "mail.email-changed.greeting": "День добрый, {{.Name}}",
"mail.email-changed.body": "Вы изменили свой адрес электронной почты на {{.NewEmail}}.<br><br>Если вы не запрашвали и не подтверждали смену электронной почты, свяжитесь с нами по адресу <a href=\"mailto:{{.SupportMail}}\">{{.SupportMail}}</a>", "mail.email-changed.body": "Вы изменили свой адрес электронной почты на {{.NewEmail}}.<br><br>Если вы не запрашвали и не подтверждали смену электронной почты, свяжитесь с нами по адресу <a href=\"mailto:{{.SupportMail}}\">{{.SupportMail}}</a>",
"mail.booking-confirmation.subj": "{{.ServiceName}}: ваша встреча подтверждена",
"mail.booking-confirmation.greeting": "День добрый, {{.Name}}",
"mail.booking-confirmation.body": "Время вашей встречи подтверждено на {{.Date}} в {{.Time}}.<br><br>Если вы хотите перенести встречу, перейдите по этой <a href=\"{{.URLReschedule}}\">ссылке</a>.<br><br>Если вы хотите отменить встречу, нажмите <a href=\"{{.URLCancel}}\">здесь</a>.",
"mail.booking-cancellation.subj": "{{.ServiceName}}: ваша встреча отменена",
"mail.booking-cancellation.greeting": "День добрый, {{.Name}}",
"mail.booking-cancellation.body": "Ваша встреча {{.Date}} в {{.Time}} была отменена.",
"mail.booking-reschedule.subj": "{{.ServiceName}}: ваша встреча назначена на новое время",
"mail.booking-reschedule.greeting": "День добрый, {{.Name}}",
"mail.booking-reschedule.body": "Ваша встреча была перенесена на новое время {{.Date}} в {{.Time}}.<br><br>Если вы хотите перенести встречу еще раз, перейдите по этой <a href=\"{{.URLReschedule} }\">ссылке</a>.<br><br>Если вы хотите отменить встречу, нажмите <a href=\"{{.URLCancel}}\">тут</a>.",
"mail.template.privacy": "Политика конфиденциальности", "mail.template.privacy": "Политика конфиденциальности",
"mail.template.unsubscribe": "Отписаться", "mail.template.unsubscribe": "Отписаться",
"btn.verify": "Подтвердить", "btn.verify": "Подтвердить",

View File

@@ -54,7 +54,7 @@ func (m *EmailNotificationTemplate) prepareUnsubscribe(msg mmail.Message) error
return nil return nil
} }
func (m *EmailNotificationTemplate) prepareButton(msg mmail.Message) error { func (m *EmailNotificationTemplate) prepareButton(_ mmail.Message) error {
var block string var block string
if m.hasButton { if m.hasButton {
var err error var err error