tasks:
  - name: Dependencies & Database
    init: |
      npm install &&
      npm run docker:compose-up &&
      cp .env.gitpod .env &&
      next_auth_secret=$(openssl rand -base64 32) &&
      sed -i -e "s|^NEXTAUTH_SECRET=.*|NEXTAUTH_SECRET=$next_auth_secret|" .env &&
      sed -i "s|NEXTAUTH_URL=\"\"|NEXTAUTH_URL=https://3000-${HOSTNAME}.${GITPOD_WORKSPACE_CLUSTER_HOST}|" .env && 
      sed -i "s|NEXT_PUBLIC_WEBAPP_URL=\"\"|NEXT_PUBLIC_WEBAPP_URL=https://3000-${HOSTNAME}.${GITPOD_WORKSPACE_CLUSTER_HOST}|" .env
    command: npm run d

  - name: Database Studio
    command: |
      gp ports await 3000
      npm run db-studio

ports:
  - name: App
    port: 3000
    visibility: public
    onOpen: open-browser

  - name: Mailbox
    port: 9000
    visibility: public
    onOpen: open-browser

  - name: Database
    port: 54320
    visibility: private
    onOpen: ignore

  - name: Mailserver
    port: 2500
    visibility: private
    onOpen: ignore

  - name: Database Studio
    port: 5555
    visibility: public

  - port: 1100
    visibility: private
    onOpen: ignore

github:
  prebuilds:
    master: true
    pullRequests: true
    pullRequestsFromForks: true
    addCheck: true
    addComment: true
    addBadge: true

vscode:
  extensions:
    - esbenp.prettier-vscode
    - bradlc.vscode-tailwindcss
    - Prisma.prisma
