locals {

  # general
  domain_name = "alexpires.me"

  # storage
  persistent_folder = "/mnt/microk8s_persistent"
  database_folder   = "/var/lib"

  # apps
  wordpress_version                    = "6.7.2"
  wordpress_fqdns                      = ["blog.${local.domain_name}", "www.${local.domain_name}", "${local.domain_name}"]
  wordpress_sql_backup_cron_schedule   = "0 2 * * *"
  wordpress_files_backup_cron_schedule = "10 2 * * *"

  gitea_version                    = "1.23.4"
  gitea_fqdn                       = "code.${local.domain_name}"
  gitea_sql_backup_cron_schedule   = "20 2 * * *"
  gitea_files_backup_cron_schedule = "30 2 * * *"

  nextcloud_version                    = "30.0.0-apache"
  nextcloud_fqdn                       = "cloud.${local.domain_name}"
  nextcloud_sql_backup_cron_schedule   = "40 2 * * *"
  nextcloud_files_backup_cron_schedule = "50 2 * * *"

  # monitoring
  influxdb_version   = "1.8-alpine"
  kapacitor_version  = "1.6-alpine"
  fluent_bit_version = "3.1"
  telegraf_version   = "1.32-alpine"
  chronograf_version = "1.9-alpine"

  # m3uproxy
  m3uproxy_version  = "latest"
  wireguard_version = "1.0.20210914-r4-ls54"
  squid_version     = "6.1-23.10_edge"
  m3uproxy_fqdn     = "tv.${local.domain_name}"
  geoip_image       = "maxmindinc/geoipupdate"
  geoip_version     = "latest"

  geoip_cron_schedule = "0 0 * * *"
  geoip_editions = [
    "GeoLite2-Country",
    "GeoLite2-City",
    "GeoLite2-ASN"
  ]

  # rustdesk
  rustdesk_version = "latest"
  rustdesk_fqdn    = "rustdesk.${local.domain_name}"

  # backup
  local_backup_retention_days = 2
  cloud_backup_retention_days = 3

  # mail settings
  getmail_version                 = "v0.0.1-6.19.07"
  fetch_emails_schedule           = "*/2 * * * *"
  mail_files_backup_cron_schedule = "0 3 * * *"

  # email settings
  scaleway_smtp_host = "smtp.tem.scw.cloud"
  scaleway_smtp_port = 587
  email_accounts = [
    {
      domain    = "alexpires.me"
      recipient = "c.alexandre.pires"
      receive = {
        type   = "imap"
        server = "mail-pt.securemail.pro"
        port   = 993
      }
      send = {
        server = "smtp-pt.securemail.pro"
        port   = 465
      }
      username  = var.alexpires_me_email_username
      password  = var.alexpires_me_email_password
      mailboxes = ["INBOX", "Sent", "Drafts", "Trash", "Spam"]
    }
  ]

}

data "scaleway_account_project" "default" {
  project_id      = var.scaleway_project_id
  organization_id = var.scaleway_organization_id
}
