Rename account env vars

account
Viktor Baranov 2 years ago
parent 911b601d24
commit ddc898b359
  1. 6
      .github/workflows/config.yml
  2. 4
      apps/explorer/lib/explorer/vault.ex
  3. 20
      config/runtime.exs
  4. 12
      config/runtime/dev.exs
  5. 4
      config/runtime/prod.exs
  6. 16
      docker-compose/envs/common-blockscout.env
  7. 72
      docker/Makefile

@ -9,9 +9,9 @@ env:
MIX_ENV: test MIX_ENV: test
OTP_VERSION: '24.3.4.1' OTP_VERSION: '24.3.4.1'
ELIXIR_VERSION: '1.13.4' ELIXIR_VERSION: '1.13.4'
AUTH0_DOMAIN: 'blockscoutcom.us.auth0.com' ACCOUNT_AUTH0_DOMAIN: 'blockscoutcom.us.auth0.com'
AUTH0_LOGOUT_URL: 'https://blockscoutcom.us.auth0.com/v2/logout' ACCOUNT_AUTH0_LOGOUT_URL: 'https://blockscoutcom.us.auth0.com/v2/logout'
AUTH0_LOGOUT_RETURN_URL: 'https://blockscout.com/auth/logout' ACCOUNT_AUTH0_LOGOUT_RETURN_URL: 'https://blockscout.com/auth/logout'
jobs: jobs:
build-and-cache: build-and-cache:

@ -7,7 +7,9 @@ defmodule Explorer.Vault do
@impl GenServer @impl GenServer
def init(config) do def init(config) do
config = config =
Keyword.put(config, :ciphers, default: {Cloak.Ciphers.AES.GCM, tag: "AES.GCM.V1", key: decode_env!("CLOAK_KEY")}) Keyword.put(config, :ciphers,
default: {Cloak.Ciphers.AES.GCM, tag: "AES.GCM.V1", key: decode_env!("ACCOUNT_CLOAK_KEY")}
)
{:ok, config} {:ok, config}
end end

@ -37,14 +37,14 @@ config :block_scout_web, :footer,
# Configures Ueberauth's Auth0 auth provider # Configures Ueberauth's Auth0 auth provider
config :ueberauth, Ueberauth.Strategy.Auth0.OAuth, config :ueberauth, Ueberauth.Strategy.Auth0.OAuth,
domain: System.get_env("AUTH0_DOMAIN"), domain: System.get_env("ACCOUNT_AUTH0_DOMAIN"),
client_id: System.get_env("AUTH0_CLIENT_ID"), client_id: System.get_env("ACCOUNT_AUTH0_CLIENT_ID"),
client_secret: System.get_env("AUTH0_CLIENT_SECRET") client_secret: System.get_env("ACCOUNT_AUTH0_CLIENT_SECRET")
# Configures Ueberauth local settings # Configures Ueberauth local settings
config :ueberauth, Ueberauth, config :ueberauth, Ueberauth,
logout_url: System.get_env("AUTH0_LOGOUT_URL"), logout_url: System.get_env("ACCOUNT_AUTH0_LOGOUT_URL"),
logout_return_to_url: System.get_env("AUTH0_LOGOUT_RETURN_URL") logout_return_to_url: System.get_env("ACCOUNT_AUTH0_LOGOUT_RETURN_URL")
config :block_scout_web, config :block_scout_web,
version: System.get_env("BLOCKSCOUT_VERSION"), version: System.get_env("BLOCKSCOUT_VERSION"),
@ -320,17 +320,17 @@ config :explorer, Explorer.SmartContract.RustVerifierInterface,
enabled: System.get_env("ENABLE_RUST_VERIFICATION_SERVICE") == "true" enabled: System.get_env("ENABLE_RUST_VERIFICATION_SERVICE") == "true"
config :explorer, Explorer.ThirdPartyIntegrations.AirTable, config :explorer, Explorer.ThirdPartyIntegrations.AirTable,
table_url: System.get_env("PUBLIC_TAGS_AIRTABLE_URL"), table_url: System.get_env("ACCOUNT_PUBLIC_TAGS_AIRTABLE_URL"),
api_key: System.get_env("PUBLIC_TAGS_AIRTABLE_API_KEY") api_key: System.get_env("ACCOUNT_PUBLIC_TAGS_AIRTABLE_API_KEY")
config :explorer, Explorer.Mailer, config :explorer, Explorer.Mailer,
adapter: Bamboo.SendGridAdapter, adapter: Bamboo.SendGridAdapter,
api_key: System.get_env("SENDGRID_API_KEY") api_key: System.get_env("ACCOUNT_SENDGRID_API_KEY")
config :explorer, Explorer.Account, config :explorer, Explorer.Account,
sendgrid: [ sendgrid: [
sender: System.get_env("SENDGRID_SENDER"), sender: System.get_env("ACCOUNT_SENDGRID_SENDER"),
template: System.get_env("SENDGRID_TEMPLATE") template: System.get_env("ACCOUNT_SENDGRID_TEMPLATE")
] ]
############### ###############

@ -74,15 +74,15 @@ config :explorer, Explorer.Repo.Replica1,
url: database_api_url, url: database_api_url,
pool_size: pool_size_api pool_size: pool_size_api
database_account_url = System.get_env("DATABASE_ACCOUNT_URL") || System.get_env("DATABASE_URL") database_account_url = System.get_env("ACCOUNT_DATABASE_URL") || System.get_env("DATABASE_URL")
pool_size_account = pool_size_account =
if System.get_env("DATABASE_ACCOUNT_URL"), if System.get_env("ACCOUNT_DATABASE_URL"),
do: String.to_integer(System.get_env("POOL_SIZE_ACCOUNT", "10")), do: String.to_integer(System.get_env("ACCOUNT_POOL_SIZE", "10")),
else: String.to_integer(System.get_env("POOL_SIZE_ACCOUNT", "10")) else: String.to_integer(System.get_env("ACCOUNT_POOL_SIZE", "10"))
database_account = if System.get_env("DATABASE_ACCOUNT_URL"), do: nil, else: database database_account = if System.get_env("ACCOUNT_DATABASE_URL"), do: nil, else: database
hostname_account = if System.get_env("DATABASE_ACCOUNT_URL"), do: nil, else: hostname hostname_account = if System.get_env("ACCOUNT_DATABASE_URL"), do: nil, else: hostname
# Configure Account database # Configure Account database
config :explorer, Explorer.Repo.Account, config :explorer, Explorer.Repo.Account,

@ -49,8 +49,8 @@ config :explorer, Explorer.Repo.Replica1,
pool_size: pool_size_api, pool_size: pool_size_api,
ssl: String.equivalent?(System.get_env("ECTO_USE_SSL") || "true", "true") ssl: String.equivalent?(System.get_env("ECTO_USE_SSL") || "true", "true")
database_account_url = System.get_env("DATABASE_ACCOUNT_URL") database_account_url = System.get_env("ACCOUNT_DATABASE_URL")
pool_size_account = String.to_integer(System.get_env("POOL_SIZE_ACCOUNT", "50")) pool_size_account = String.to_integer(System.get_env("ACCOUNT_POOL_SIZE", "50"))
# Configures Account database # Configures Account database
config :explorer, Explorer.Repo.Account, config :explorer, Explorer.Repo.Account,

@ -125,6 +125,16 @@ FETCH_REWARDS_WAY=trace_block
ENABLE_RUST_VERIFICATION_SERVICE=true ENABLE_RUST_VERIFICATION_SERVICE=true
RUST_VERIFICATION_SERVICE_URL=http://host.docker.internal:8043/ RUST_VERIFICATION_SERVICE_URL=http://host.docker.internal:8043/
# DATABASE_READ_ONLY_API_URL= # DATABASE_READ_ONLY_API_URL=
# DATABASE_ACCOUNT_URL= # ACCOUNT_DATABASE_URL=
# POOL_SIZE_ACCOUNT= # ACCOUNT_POOL_SIZE=
CLOAK_KEY= # ACCOUNT_AUTH0_DOMAIN=
# ACCOUNT_AUTH0_CLIENT_ID=
# ACCOUNT_AUTH0_CLIENT_SECRET=
# ACCOUNT_AUTH0_LOGOUT_URL=
# ACCOUNT_AUTH0_LOGOUT_RETURN_URL=
# ACCOUNT_PUBLIC_TAGS_AIRTABLE_URL=
# ACCOUNT_PUBLIC_TAGS_AIRTABLE_API_KEY=
# ACCOUNT_SENDGRID_API_KEY=
# ACCOUNT_SENDGRID_SENDER=
# ACCOUNT_SENDGRID_TEMPLATE=
ACCOUNT_CLOAK_KEY=

@ -355,36 +355,6 @@ endif
ifdef CACHE_ADDRESS_TOKEN_TRANSFERS_COUNTER_PERIOD ifdef CACHE_ADDRESS_TOKEN_TRANSFERS_COUNTER_PERIOD
BLOCKSCOUT_CONTAINER_PARAMS += -e 'CACHE_ADDRESS_TOKEN_TRANSFERS_COUNTER_PERIOD=$(CACHE_ADDRESS_TOKEN_TRANSFERS_COUNTER_PERIOD)' BLOCKSCOUT_CONTAINER_PARAMS += -e 'CACHE_ADDRESS_TOKEN_TRANSFERS_COUNTER_PERIOD=$(CACHE_ADDRESS_TOKEN_TRANSFERS_COUNTER_PERIOD)'
endif endif
ifdef AUTH0_DOMAIN
BLOCKSCOUT_CONTAINER_PARAMS += -e 'AUTH0_DOMAIN=$(AUTH0_DOMAIN)'
endif
ifdef AUTH0_CLIENT_ID
BLOCKSCOUT_CONTAINER_PARAMS += -e 'AUTH0_CLIENT_ID=$(AUTH0_CLIENT_ID)'
endif
ifdef AUTH0_CLIENT_SECRET
BLOCKSCOUT_CONTAINER_PARAMS += -e 'AUTH0_CLIENT_SECRET=$(AUTH0_CLIENT_SECRET)'
endif
ifdef AUTH0_LOGOUT_RETURN_URL
BLOCKSCOUT_CONTAINER_PARAMS += -e 'AUTH0_LOGOUT_RETURN_URL=$(AUTH0_LOGOUT_RETURN_URL)'
endif
ifdef AUTH0_LOGOUT_URL
BLOCKSCOUT_CONTAINER_PARAMS += -e 'AUTH0_LOGOUT_URL=$(AUTH0_LOGOUT_URL)'
endif
ifdef SENDGRID_API_KEY
BLOCKSCOUT_CONTAINER_PARAMS += -e 'SENDGRID_API_KEY=$(SENDGRID_API_KEY)'
endif
ifdef SENDGRID_SENDER
BLOCKSCOUT_CONTAINER_PARAMS += -e 'SENDGRID_SENDER=$(SENDGRID_SENDER)'
endif
ifdef SENDGRID_TEMPLATE
BLOCKSCOUT_CONTAINER_PARAMS += -e 'SENDGRID_TEMPLATE=$(SENDGRID_TEMPLATE)'
endif
ifdef PUBLIC_TAGS_AIRTABLE_URL
BLOCKSCOUT_CONTAINER_PARAMS += -e 'PUBLIC_TAGS_AIRTABLE_URL=$(PUBLIC_TAGS_AIRTABLE_URL)'
endif
ifdef PUBLIC_TAGS_AIRTABLE_API_KEY
BLOCKSCOUT_CONTAINER_PARAMS += -e 'PUBLIC_TAGS_AIRTABLE_API_KEY=$(PUBLIC_TAGS_AIRTABLE_API_KEY)'
endif
ifdef API_RATE_LIMIT ifdef API_RATE_LIMIT
BLOCKSCOUT_CONTAINER_PARAMS += -e 'API_RATE_LIMIT=$(API_RATE_LIMIT)' BLOCKSCOUT_CONTAINER_PARAMS += -e 'API_RATE_LIMIT=$(API_RATE_LIMIT)'
endif endif
@ -499,14 +469,44 @@ endif
ifdef RUST_VERIFICATION_SERVICE_URL ifdef RUST_VERIFICATION_SERVICE_URL
BLOCKSCOUT_CONTAINER_PARAMS += -e 'RUST_VERIFICATION_SERVICE_URL=$(RUST_VERIFICATION_SERVICE_URL)' BLOCKSCOUT_CONTAINER_PARAMS += -e 'RUST_VERIFICATION_SERVICE_URL=$(RUST_VERIFICATION_SERVICE_URL)'
endif endif
ifdef DATABASE_ACCOUNT_URL ifdef ACCOUNT_AUTH0_DOMAIN
BLOCKSCOUT_CONTAINER_PARAMS += -e 'DATABASE_ACCOUNT_URL=$(DATABASE_ACCOUNT_URL)' BLOCKSCOUT_CONTAINER_PARAMS += -e 'ACCOUNT_AUTH0_DOMAIN=$(ACCOUNT_AUTH0_DOMAIN)'
endif
ifdef ACCOUNT_AUTH0_CLIENT_ID
BLOCKSCOUT_CONTAINER_PARAMS += -e 'ACCOUNT_AUTH0_CLIENT_ID=$(ACCOUNT_AUTH0_CLIENT_ID)'
endif
ifdef ACCOUNT_AUTH0_CLIENT_SECRET
BLOCKSCOUT_CONTAINER_PARAMS += -e 'ACCOUNT_AUTH0_CLIENT_SECRET=$(ACCOUNT_AUTH0_CLIENT_SECRET)'
endif
ifdef ACCOUNT_AUTH0_LOGOUT_RETURN_URL
BLOCKSCOUT_CONTAINER_PARAMS += -e 'ACCOUNT_AUTH0_LOGOUT_RETURN_URL=$(ACCOUNT_AUTH0_LOGOUT_RETURN_URL)'
endif
ifdef ACCOUNT_AUTH0_LOGOUT_URL
BLOCKSCOUT_CONTAINER_PARAMS += -e 'ACCOUNT_AUTH0_LOGOUT_URL=$(ACCOUNT_AUTH0_LOGOUT_URL)'
endif
ifdef ACCOUNT_SENDGRID_API_KEY
BLOCKSCOUT_CONTAINER_PARAMS += -e 'ACCOUNT_SENDGRID_API_KEY=$(ACCOUNT_SENDGRID_API_KEY)'
endif
ifdef ACCOUNT_SENDGRID_SENDER
BLOCKSCOUT_CONTAINER_PARAMS += -e 'ACCOUNT_SENDGRID_SENDER=$(ACCOUNT_SENDGRID_SENDER)'
endif
ifdef ACCOUNT_SENDGRID_TEMPLATE
BLOCKSCOUT_CONTAINER_PARAMS += -e 'ACCOUNT_SENDGRID_TEMPLATE=$(ACCOUNT_SENDGRID_TEMPLATE)'
endif
ifdef ACCOUNT_PUBLIC_TAGS_AIRTABLE_URL
BLOCKSCOUT_CONTAINER_PARAMS += -e 'ACCOUNT_PUBLIC_TAGS_AIRTABLE_URL=$(ACCOUNT_PUBLIC_TAGS_AIRTABLE_URL)'
endif
ifdef ACCOUNT_PUBLIC_TAGS_AIRTABLE_API_KEY
BLOCKSCOUT_CONTAINER_PARAMS += -e 'ACCOUNT_PUBLIC_TAGS_AIRTABLE_API_KEY=$(ACCOUNT_PUBLIC_TAGS_AIRTABLE_API_KEY)'
endif
ifdef ACCOUNT_DATABASE_URL
BLOCKSCOUT_CONTAINER_PARAMS += -e 'ACCOUNT_DATABASE_URL=$(ACCOUNT_DATABASE_URL)'
endif endif
ifdef POOL_SIZE_ACCOUNT ifdef ACCOUNT_POOL_SIZE
BLOCKSCOUT_CONTAINER_PARAMS += -e 'POOL_SIZE_ACCOUNT=$(POOL_SIZE_ACCOUNT)' BLOCKSCOUT_CONTAINER_PARAMS += -e 'ACCOUNT_POOL_SIZE=$(ACCOUNT_POOL_SIZE)'
endif endif
ifdef CLOAK_KEY ifdef ACCOUNT_CLOAK_KEY
BLOCKSCOUT_CONTAINER_PARAMS += -e 'CLOAK_KEY=$(CLOAK_KEY)' BLOCKSCOUT_CONTAINER_PARAMS += -e 'ACCOUNT_CLOAK_KEY=$(ACCOUNT_CLOAK_KEY)'
endif endif
HAS_BLOCKSCOUT_IMAGE := $(shell docker images | grep -sw "${BS_CONTAINER_IMAGE} ") HAS_BLOCKSCOUT_IMAGE := $(shell docker images | grep -sw "${BS_CONTAINER_IMAGE} ")

Loading…
Cancel
Save