Files
oswald-infra/ansible/plays/machine_setup/templates/supernote-email-init.sql.j2
T
2026-09-08 03:36:17 +00:00

31 lines
1.2 KiB
Django/Jinja

-- Managed by Ansible (supernote.yml) - SMTP secrets sourced from Infisical
-- via `infisical run -- ansible-playbook ...`.
--
-- Mounted into the mariadb container's docker-entrypoint-initdb.d/ so it
-- seeds u_email_config on first boot, and re-applied by the playbook via
-- `docker compose exec` on every run so Infisical stays the source of truth.
--
-- u_email_config's schema/upsert key come from a third-party reverse
-- engineering of Supernote's supernotedb.sql (not officially documented) -
-- see https://github.com/liketheduck/supernote-private-cloud-docker. Verify
-- against Email Settings in the web UI if Supernote changes this schema.
USE supernotedb;
INSERT INTO u_email_config (smtp_server, port, user_name, password, encryption, flag)
VALUES (
'{{ supernote_smtp_server }}',
'{{ supernote_smtp_port | default(465) }}',
'{{ supernote_smtp_user }}',
'{{ supernote_smtp_password }}',
'{{ supernote_smtp_encryption | default("ssl") }}',
'Y'
)
ON DUPLICATE KEY UPDATE
smtp_server='{{ supernote_smtp_server }}',
port='{{ supernote_smtp_port | default(465) }}',
user_name='{{ supernote_smtp_user }}',
password='{{ supernote_smtp_password }}',
encryption='{{ supernote_smtp_encryption | default("ssl") }}',
flag='Y';