provisioning/.provisioning/extensions/providers/digitalocean/hooks/notify-created.nu
2025-09-22 23:11:41 +01:00

28 lines
806 B
Plaintext
Executable File

#!/usr/bin/env nu
# Post-server-create hook for DigitalOcean
# Sends notifications after server creation
def main [context: string] {
let ctx = ($context | from json)
print $"📡 Sending notification for DigitalOcean server creation..."
# Extract server info from context
let servers = ($ctx | get -o servers | default [])
$servers | each {|server|
print $"✅ Server created: ($server.hostname) in ($server.region)"
# Here you could send to Slack, Discord, email, etc.
# Example: webhook notification
# http post $webhook_url { server: $server.hostname, status: "created" }
}
# Output notification results
{
provider: "digitalocean"
notification: "sent"
servers_notified: ($servers | length)
} | to json
}