Skip to content

Commit

Permalink
Move Database Connection Credentials to Environment Variables (lambda…
Browse files Browse the repository at this point in the history
…class#391)

* Added: DB env changes

* Fixes: Added Default Value

* Fixes: Added New line
  • Loading branch information
anukkrit149 authored and apoorvsadana committed Dec 22, 2023
1 parent 2eac53e commit c636cb9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
Binary file added .DS_Store
Binary file not shown.
5 changes: 5 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,8 @@ export DISABLE_MAINNET_SYNC=true # Set to true if you want to disable mainnet sy
export DISABLE_TESTNET_SYNC=true # Set to true if you want to disable testnet sync
export RPC_API_HOST=<YOUR_RPC_API_HOST> # Set to your mainnet rpc api host, is will be used in the explorer as "Mainnet"
export TESTNET_RPC_API_HOST=<YOUR_TESTNET_RPC_API_HOST> # Set to your testnet rpc api host, is will be used in the explorer as "Testnet"
export DB_NAME=<DB_NAME> # set DB creds
export DB_USER=<DB_USER>
export DB_PASS=<DB_PASS>
export DB_HOST=<DB_HOST>

8 changes: 4 additions & 4 deletions config/dev.exs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import Config
# Configure your database
if System.get_env("DB_TYPE") == "postgresql" do
config :starknet_explorer, StarknetExplorer.Repo,
database: "madaraexplorer_dev",
username: "madaraexplorer_user",
password: "madaraexplorerlambda",
hostname: "localhost",
database: System.get_env("DB_NAME", "madaraexplorer_dev"),
username: System.get_env("DB_USER", "madaraexplorer_user"),
password: System.get_env("DB_PASS", "madaraexplorerlambda"),
hostname: System.get_env("DB_HOST", "localhost"),
port: 5432
else
config :starknet_explorer, StarknetExplorer.Repo,
Expand Down
9 changes: 2 additions & 7 deletions config/runtime.exs
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,8 @@ if config_env() == :prod do
server: true,
url: [host: host, port: 443, scheme: "https"],
check_origin: [
"https://madaraexplorer.com",
"https://www.madaraexplorer.com",
"https://madaraexplorer.lambdaclass.com",
"https://testing.madaraexplorer.com",
"https://starkcompass.com",
"https://www.starkcompass.com",
"https://testing.starkcompass.com",
"http://paradex-explorer.karnot.xyz/",
"https://paradex-explorer.karnot.xyz/",
"https://#{host}:#{port}",
"http://#{host}:#{port}"
],
Expand Down

0 comments on commit c636cb9

Please sign in to comment.