Browse Source

new: [smtp-stub] new charm

rallly
Boris Gallet 1 year ago
committed by Valentin Lab
parent
commit
8bf2a8c728
  1. 28
      smtp-stub/hooks/smtp_server-relation-joined
  2. 11
      smtp-stub/metadata.yml

28
smtp-stub/hooks/smtp_server-relation-joined

@ -0,0 +1,28 @@
#!/bin/bash
set -e
OPTS=(
host
port
connection-security
auth-method
)
for var in "${OPTS[@]}"; do
value=$(options-get "$var") && relation-set "$var" "$value" || exit 1
case "$var:$value" in
auth-method:password)
login=$(options-get "login") || {
err "${WHITE}login${NORMAL} value is required when ${WHITE}auth-method${NORMAL} is set to \"password\""
exit 1
}
password=$(options-get "password") || {
err "${WHITE}password${NORMAL} value is required when ${WHITE}auth-method${NORMAL} is set to \"password\""
exit 1
}
relation-set login "$login"
relation-set password "$password"
;;
esac
done

11
smtp-stub/metadata.yml

@ -0,0 +1,11 @@
type: stub
provides:
smtp-server:
default-options:
port: 25
connection-security: none # "none", "starttls", "ssl/tls"
auth-method: none # "none", "password"
user:
password:
Loading…
Cancel
Save