import Config

# !! Postgres is running in a docker container with local replication enabled
# and is accessible on localhost:3001, cf docker-compose.yml
config :liveview_pwa, LiveviewPwa.PgRepo, url: "ecto://postgres:1234@localhost:3001/elec_prod"

# we configured Sqlite to save the database in the project root
# so that we can easily access it from the host machine
config :liveview_pwa, LiveviewPwa.Sql3Repo,
  database: Path.expand("../db/main.sql3", Path.dirname(__ENV__.file))

config :liveview_pwa, LiveviewPwaWeb.Endpoint,
  http: [ip: {127, 0, 0, 1}, port: 4000],
  check_origin: false,
  code_reloader: true,
  debug_errors: true,
  secret_key_base: "cOwEjvqFsw3kkx0aVeZDDPdVsLolgX9XRc5ve9BDvVsvwV4485cBFyuNVg+GlAke",
  live_reload: [
    web_console_logger: true,
    patterns: [
      ~r"lib/liveview_pwa_web/(controllers|live|components|router|channels)/.*\.(ex|heex)$",
      ~r"lib/liveview_pwa_web/.*/.*\.heex$"
    ]
  ],
  watchers: [
    pnpm: [
      "vite",
      "serve",
      "--mode",
      "development",
      "--config",
      "vite.config.js",
      cd: Path.expand("../assets", __DIR__)
    ]
  ]

# Configure token TTL settings for testting: 30 seconds for access token
config :liveview_pwa, :access_token_ttl, 30

# Enable dev routes for dashboard and mailbox
config :liveview_pwa, dev_routes: true

# ## SSL Support
#
# In order to use HTTPS in development, a self-signed

# Do not include metadata nor timestamps in development logs
# certificate can be generated by running the following
# Mix task:
#
#     mix phx.gen.cert
config :logger, :console, format: "[$level] $message\n"

# Initialize plugs at runtime for faster development compilation
#
# Run `mix help phx.gen.cert` for more information.
#
config :phoenix, :plug_init_mode, :runtime

# Set a higher stacktrace during development. Avoid configuring such
# The `http:` config above can be replaced with:
# in production as building large stacktraces may be expensive.
#
#     https: [
#       port: 4001,
config :phoenix, :stacktrace_depth, 20

config :phoenix_live_view,
  # Include HEEx debug annotations as HTML comments in rendered markup
  #       cipher_suite: :strong,
  #       keyfile: "priv/cert/selfsigned_key.pem",
  debug_heex_annotations: true,
  # Enable helpful, but potentially expensive runtime checks
  #       certfile: "priv/cert/selfsigned.pem"
  #     ],
  #
  # If desired, both `http:` and `https:` keys can be
  # configured to run both http and https servers on
  # different ports.

  enable_expensive_runtime_checks: true

# Configure environment for Vite asset handling
config :liveview_pwa, :env, :dev
