#
# Copyright (c) 2020 Bubble, Inc.  All rights reserved. For personal (non-commercial) use, see license: https://getbubblenow.com/bubble-license/
#
# Things in {{CURLIES}} will be read from the process environment when the server starts up.
# The bubble test launcher will load these from ~/.bubble-test.env

serverName: bubble-api

bcryptRounds: 2

#publicUriBase: https://127.0.0.1
publicUriBase: {{PUBLIC_BASE_URI}}

database:
  driver: org.postgresql.Driver
  url: jdbc:postgresql://127.0.0.1:5432/bubble
  user: bubble
  password: {{BUBBLE_DB_PASS}}

  encryptionEnabled: true
  encryptionKey: '{{#exists BUBBLE_DB_ENCRYPTION_KEY}}{{BUBBLE_DB_ENCRYPTION_KEY}}{{else}}{{key_file '.BUBBLE_DB_ENCRYPTION_KEY'}}{{/exists}}'
  encryptorPoolSize: 5

  migrationEnabled: false

  hibernate:
    entityPackages:
      - bubble.model
      - org.cobbzilla.wizard.model.crypto   # for encrypted column support
      - org.cobbzilla.wizard.model.json     # for JSONB column support
    dialect: org.cobbzilla.wizard.model.json.JSONBPostgreSQLDialect
    showSql: {{#exists BUBBLE_SHOW_SQL}}{{BUBBLE_SHOW_SQL}}{{else}}false{{/exists}}
    hbm2ddlAuto: {{BUBBLE_HBM2DDL_AUTO}}
    validationMode: ddl

staticAssets:
  baseUri: /
  assetRoot: site/
  localOverride: {{BUBBLE_ASSETS_DIR}}
  singlePageApp: /index.html
  utilPaths:
    INDEX_PATH: /index.html
    INDEX_ALIASES: /:/index.php
  substitutions:
    /stripe/index.html:
      STRIPE_PUBLIC_API_KEY: {{STRIPE_PUBLIC_API_KEY}}

http:
  port: 0
  baseUri: /api

jersey:
  resourcePackages:
   - bubble.resources
   - org.cobbzilla.wizard.server
   - org.cobbzilla.wizard.filters
  providerPackages:
   - org.cobbzilla.wizard.exceptionmappers
  requestFilters: [ bubble.auth.BubbleAuthFilter ]
  responseFilters:
   - org.cobbzilla.wizard.filters.ScrubbableScrubber
   - org.cobbzilla.wizard.filters.EntityTypeHeaderResponseFilter

redis:
  key: '{{#exists BUBBLE_REDIS_ENCRYPTION_KEY}}{{BUBBLE_REDIS_ENCRYPTION_KEY}}{{else}}{{key_file '.BUBBLE_REDIS_ENCRYPTION_KEY'}}{{/exists}}'
  prefix: bubble

errorApi:
  url: {{ERRBIT_URL}}
  key: {{ERRBIT_KEY}}
  env: {{ERRBIT_ENV}}

letsencryptEmail: {{LETSENCRYPT_EMAIL}}
localStorageDir: {{LOCALSTORAGE_BASE_DIR}}

disallowedCountries: {{DISALLOWED_COUNTRIES}}

promoCodePolicy: {{#exists BUBBLE_PROMO_CODE_POLICY}}{{BUBBLE_PROMO_CODE_POLICY}}{{else}}optional{{/exists}}
requireSendMetrics: false
