Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Clivern committed Feb 4, 2024
1 parent 216dfeb commit 91d466c
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 17 deletions.
30 changes: 15 additions & 15 deletions config/dev.exs
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,30 @@
import Config

# Configure your database
if System.get_env("DB_SSL") == "on" do
if System.get_env("DB_SSL") || "off" == "on" do
config :campfire, Campfire.Repo,
username: System.get_env("DB_USERNAME"),
password: System.get_env("DB_PASSWORD"),
hostname: System.get_env("DB_HOSTNAME"),
database: System.get_env("DB_DATABASE"),
port: String.to_integer(System.get_env("DB_PORT")),
maintenance_database: System.get_env("DB_DATABASE"),
username: System.get_env("DB_USERNAME") || "campfire",
password: System.get_env("DB_PASSWORD") || "campfire",
hostname: System.get_env("DB_HOSTNAME") || "localhost",
database: System.get_env("DB_DATABASE") || "campfire_dev",
port: String.to_integer(System.get_env("DB_PORT") || "5432"),
maintenance_database: System.get_env("DB_DATABASE") || "campfire_dev",
stacktrace: true,
show_sensitive_data_on_connection_error: true,
pool_size: String.to_integer(System.get_env("DB_POOL_SIZE") || "10"),
ssl: true,
ssl_opts: [
verify: :verify_peer,
cacertfile: System.get_env("DB_CA_CERTFILE_PATH")
cacertfile: System.get_env("DB_CA_CERTFILE_PATH") || ""
]
else
config :campfire, Campfire.Repo,
username: System.get_env("DB_USERNAME"),
password: System.get_env("DB_PASSWORD"),
hostname: System.get_env("DB_HOSTNAME"),
database: System.get_env("DB_DATABASE"),
port: String.to_integer(System.get_env("DB_PORT")),
maintenance_database: System.get_env("DB_DATABASE"),
username: System.get_env("DB_USERNAME") || "campfire",
password: System.get_env("DB_PASSWORD") || "campfire",
hostname: System.get_env("DB_HOSTNAME") || "localhost",
database: System.get_env("DB_DATABASE") || "campfire_dev",
port: String.to_integer(System.get_env("DB_PORT") || "5432"),
maintenance_database: System.get_env("DB_DATABASE") || "campfire_dev",
stacktrace: true,
show_sensitive_data_on_connection_error: true,
pool_size: String.to_integer(System.get_env("DB_POOL_SIZE") || "10")
Expand All @@ -48,7 +48,7 @@ config :campfire, CampfireWeb.Endpoint,
check_origin: false,
code_reloader: true,
debug_errors: true,
secret_key_base: System.get_env("APP_SECRET"),
secret_key_base: System.get_env("APP_SECRET") || "",
watchers: [
# Start the esbuild watcher by calling Esbuild.install_and_run(:default, args)
esbuild: {Esbuild, :install_and_run, [:default, ~w(--sourcemap=inline --watch)]}
Expand Down
4 changes: 4 additions & 0 deletions config/prod.exs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright 2023 Clivern. All rights reserved.
# Use of this source code is governed by the MIT
# license that can be found in the LICENSE file.

import Config

# For production, don't forget to configure the url host
Expand Down
8 changes: 6 additions & 2 deletions config/runtime.exs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright 2023 Clivern. All rights reserved.
# Use of this source code is governed by the MIT
# license that can be found in the LICENSE file.

import Config

# config/runtime.exs is executed for all environments, including
Expand All @@ -23,7 +27,7 @@ end
if config_env() == :prod do
maybe_ipv6 = if System.get_env("ECTO_IPV6"), do: [:inet6], else: []

if System.get_env("DB_SSL") == "on" do
if System.get_env("DB_SSL") || "off" == "on" do
config :campfire, Campfire.Repo,
username: System.get_env("DB_USERNAME"),
password: System.get_env("DB_PASSWORD"),
Expand All @@ -36,7 +40,7 @@ if config_env() == :prod do
ssl: true,
ssl_opts: [
verify: :verify_peer,
cacertfile: System.get_env("DB_CA_CERTFILE_PATH")
cacertfile: System.get_env("DB_CA_CERTFILE_PATH") || ""
]
else
config :campfire, Campfire.Repo,
Expand Down
4 changes: 4 additions & 0 deletions config/test.exs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright 2023 Clivern. All rights reserved.
# Use of this source code is governed by the MIT
# license that can be found in the LICENSE file.

import Config

# Configure your database
Expand Down

0 comments on commit 91d466c

Please sign in to comment.