captainVersion: 4
services:
    # Calendso
    $$cap_appname:
        image: ctadeu/calendso:$$cap_app_version
        depends_on:
            - $$cap_appname-db
        restart: always
        ports:
            - $$cap_prisma_studio_port:5555
        environment:
            DATABASE_URL: postgresql://$$cap_dbuser:$$cap_dbpass@srv-captain--$$cap_appname-db:5432/$$cap_dbname
            GOOGLE_API_CREDENTIALS: $$cap_google_api_credentials
            DAILY_API_KEY: $$cap_daily_api_key
            BASE_URL: http://$$cap_appname.$$cap_root_domain
            NEXT_PUBLIC_APP_URL: http://$$cap_appname.$$cap_root_domain
            NEXT_TELEMETRY_DISABLED: $$cap_next_telemetry_disabled
            JWT_SECRET: $$cap_jwt_secret
            NODE_TLS_REJECT_UNAUTHORIZED: $$cap_tls_reject_unauthorized
            # Used for the Office 365 / Outlook.com Calendar integration
            MS_GRAPH_CLIENT_ID: $$cap_ms_graph_client_id
            MS_GRAPH_CLIENT_SECRET: $$cap_ms_graph_client_secret
            # Used for the Zoom integration
            ZOOM_CLIENT_ID: $$cap_zoom_client_id
            ZOOM_CLIENT_SECRET: $$cap_zoom_client_secret
            # E-mail settings
            # Configures the global From: header whilst sending emails.
            EMAIL_FROM: $$cap_email_from
            # Configure SMTP settings (@see https://nodemailer.com/smtp/).
            EMAIL_SERVER_HOST: $$cap_email_server_host
            EMAIL_SERVER_PORT: $$cap_email_server_port
            EMAIL_SERVER_USER: $$cap_email_server_user
            EMAIL_SERVER_PASSWORD: $$cap_email_server_password
            CALENDSO_ENCRYPTION_KEY: $$cap_calendso_encryption_key
            # Stripe Config
            NEXT_PUBLIC_STRIPE_PUBLIC_KEY: $$cap_next_public_stripe_key
            STRIPE_PRIVATE_KEY: $$cap_stripe_private_key
            STRIPE_CLIENT_ID: $$cap_stripe_client_id
            STRIPE_WEBHOOK_SECRET: $$cap_stripe_webhook_secret
            PAYMENT_FEE_PERCENTAGE: $$cap_payment_fee_percentage
            PAYMENT_FEE_FIXED: $$cap_payment_fee_fixed
            NEXT_PUBLIC_INTERCOM_APP_ID: $$cap_next_public_intercom_app_id
        caproverExtra:
            containerHttpPort: '3000'
    # Database
    $$cap_appname-db:
        image: postgres:$$cap_postgres_version
        volumes:
            - $$cap_appname-db:/var/lib/postgresql/data
        restart: always
        environment:
            POSTGRES_DB: $$cap_dbname
            POSTGRES_USER: $$cap_dbuser
            POSTGRES_PASSWORD: $$cap_dbpass
        caproverExtra:
            notExposeAsWebApp: 'true'

caproverOneClickApp:
    variables:
        - id: $$cap_app_version
          label: Calendso Version
          defaultValue: '0.0.17-1'
          description: Check out their docker page for the valid tags https://hub.docker.com/r/ctadeu/calendso/tags

        - id: $$cap_postgres_version
          label: Postgres Version
          defaultValue: '13'
          description: Check out their Docker page for the valid tags https://hub.docker.com/r/library/postgres/tags/
          validRegex: /^([^\s^\/])+$/

        - id: $$cap_dbname
          label: Database Name
          defaultValue: 'calendso'
          validRegex: /^([^\s^\/])+$/

        - id: $$cap_dbuser
          label: Database User
          defaultValue: 'calendso'
          validRegex: /^([^\s^\/])+$/

        - id: $$cap_dbpass
          label: Database Password
          defaultValue: $$cap_gen_random_hex(64)
          validRegex: /^([^\s^\/])+$/

        - id: $$cap_google_api_credentials
          label: Google API Credentials
          description: You can get this from the Google API Console (https://console.cloud.google.com/apis/dashboard). More details on this can be found below under the Obtaining the Google API Credentials section (https://github.com/calendso/calendso#Obtaining-the-Google-API-Credentials).

        - id: $$cap_daily_api_key
          label: Daily API Key
          description: Obtain from https://dashboard.daily.co/developers

        - id: $$cap_prisma_studio_port
          label: Prisma Studio Port
          defaultValue: '5555'
          validRegex: /^\d+$/

        - id: $$cap_next_telemetry_disabled
          label: Next Telemetry Disabled
          defaultValue: '1'
          validRegex: /^(0|1)$/
          description: Next.js collects completely anonymous telemetry data about general usage. Participation in this anonymous program is optional, and you may opt-out if you'd not like to share any information. Setting to 0 enables the telemetry.

        - id: $$cap_tls_reject_unauthorized
          label: Node TLS Reject Unauthorized
          defaultValue: '1'
          validRegex: /^(0|1)$/

        - id: $$cap_jwt_secret
          label: JWT Secret
          defaultValue: $$cap_gen_random_hex(64)
          validRegex: /^([^\s^\/])+$/

        - id: $$cap_ms_graph_client_id
          label: MS Graph Client ID
          description: Used for the Office 365 / Outlook.com Calendar integration

        - id: $$cap_ms_graph_client_secret
          label: MS Graph Client Secret
          description: Used for the Office 365 / Outlook.com Calendar integration

        - id: $$cap_zoom_client_id
          label: Zoom Client ID
          description: Used for the Zoom integration

        - id: $$cap_zoom_client_secret
          label: Zoom Client ID
          description: Used for the Zoom integration

        - id: $$cap_email_from
          label: Email From Address
          description: Configures the global From header whilst sending emails

        - id: $$cap_email_server_host
          label: Email Server Host

        - id: $$cap_email_server_port
          label: Email Server Port

        - id: $$cap_email_server_user
          label: Email Server User

        - id: $$cap_email_server_password
          label: Email Server Password

        - id: $$cap_calendso_encryption_key
          label: Calendso Encryption Key
          defaultValue: $$cap_gen_random_hex(32)
          description: Encryption key that will be used to encrypt CalDAV credentials, choose a random string, for example with `dd if=/dev/urandom bs=1K count=1 | md5sum`
          validRegex: /^([^\s^\/])+$/

        - id: $$cap_next_public_stripe_key
          label: Stripe Public Key

        - id: $$cap_stripe_private_key
          label: Stripe Private Key

        - id: $$cap_stripe_client_id
          label: Stripe Client ID

        - id: $$cap_stripe_webhook_secret
          label: Stripe Webhook Secret

        - id: $$cap_payment_fee_percentage
          label: Stripe Payment Fee Percentage

        - id: $$cap_payment_fee_fixed
          label: Stripe Payment Fee Fixed

        - id: $$cap_next_public_intercom_app_id
          label: Next Public Intercom App ID

    instructions:
        start: >-
            The open-source Calendly alternative.
        end: >-
            Done! 😄
            Your service is available at http://$$cap_appname.$$cap_root_domain
            Make sure to enable https on your domain
    displayName: 'Calendso'
    isOfficial: false
    description: The open-source Calendly alternative. You are in control of your events and data.
    documentation: https://calendso.com/
