From b350f655d9968ce2eb203a80d3066ac1e1b6f206 Mon Sep 17 00:00:00 2001 From: Stephan D Date: Tue, 17 Mar 2026 15:30:21 +0100 Subject: [PATCH] config split --- Makefile | 6 + api/billing/documents/config.dev.yml | 2 +- api/billing/documents/config.local.yml | 48 ++++++ api/billing/fees/config.dev.yml | 4 +- api/billing/fees/config.local.yml | 42 +++++ api/discovery/config.local.yml | 21 +++ api/edge/bff/config.dev.yml | 10 +- api/edge/bff/config.local.yml | 146 ++++++++++++++++++ api/edge/callbacks/config.local.yml | 55 +++++++ api/fx/ingestor/config.local.yml | 74 +++++++++ api/fx/oracle/config.dev.yml | 2 +- api/fx/oracle/config.local.yml | 38 +++++ api/gateway/aurora/config.dev.yml | 2 +- api/gateway/aurora/config.local.yml | 62 ++++++++ api/gateway/chain/config.dev.yml | 2 +- api/gateway/chain/config.local.yml | 70 +++++++++ api/gateway/chsettle/config.dev.yml | 2 +- api/gateway/chsettle/config.local.yml | 52 +++++++ api/gateway/mntx/config.dev.yml | 2 +- api/gateway/mntx/config.local.yml | 62 ++++++++ api/gateway/tgsettle/config.dev.yml | 2 +- api/gateway/tgsettle/config.local.yml | 52 +++++++ api/gateway/tron/config.dev.yml | 2 +- api/gateway/tron/config.local.yml | 67 ++++++++ api/ledger/config.dev.yml | 2 +- api/ledger/config.local.yml | 42 +++++ api/notification/config.local.yml | 94 +++++++++++ api/payments/methods/config.dev.yml | 2 +- api/payments/methods/config.local.yml | 49 ++++++ api/payments/orchestrator/config.dev.yml | 2 +- api/payments/orchestrator/config.local.yml | 61 ++++++++ api/payments/quotation/config.dev.yml | 6 +- api/payments/quotation/config.local.yml | 52 +++++++ ci/prod/compose/aurora_gateway.dockerfile | 3 +- ci/prod/compose/billing_documents.dockerfile | 3 +- ci/prod/compose/billing_fees.dockerfile | 3 +- ci/prod/compose/chsettle_gateway.dockerfile | 3 +- ci/prod/compose/discovery.dockerfile | 3 +- ci/prod/compose/fx_ingestor.dockerfile | 3 +- ci/prod/compose/fx_oracle.dockerfile | 3 +- ci/prod/compose/ledger.dockerfile | 3 +- ci/prod/compose/mntx_gateway.dockerfile | 3 +- ci/prod/compose/notification.dockerfile | 3 +- ci/prod/compose/payments_methods.dockerfile | 3 +- .../compose/payments_orchestrator.dockerfile | 3 +- ci/prod/compose/payments_quotation.dockerfile | 3 +- ci/prod/compose/tgsettle_gateway.dockerfile | 3 +- ci/scripts/aurora/build-image.sh | 2 + ci/scripts/bff/build-image.sh | 5 +- ci/scripts/billing_documents/build-image.sh | 2 + ci/scripts/billing_fees/build-image.sh | 2 + ci/scripts/callbacks/build-image.sh | 5 +- ci/scripts/chain_gateway/build-image.sh | 5 +- ci/scripts/check-config-coherence.sh | 88 +++++++++++ ci/scripts/chsettle/build-image.sh | 2 + ci/scripts/common/runtime_env.sh | 12 ++ ci/scripts/discovery/build-image.sh | 2 + ci/scripts/fx/build-image.sh | 13 ++ ci/scripts/ledger/build-image.sh | 2 + ci/scripts/mntx/build-image.sh | 2 + ci/scripts/notification/build-image.sh | 2 + ci/scripts/payments_methods/build-image.sh | 2 + .../payments_orchestrator/build-image.sh | 2 + ci/scripts/payments_quotation/build-image.sh | 2 + ci/scripts/tgsettle/build-image.sh | 2 + ci/scripts/tron_gateway/build-image.sh | 5 +- docker-compose.dev.yml | 32 ++-- 67 files changed, 1299 insertions(+), 67 deletions(-) create mode 100644 api/billing/documents/config.local.yml create mode 100644 api/billing/fees/config.local.yml create mode 100644 api/discovery/config.local.yml create mode 100755 api/edge/bff/config.local.yml create mode 100644 api/edge/callbacks/config.local.yml create mode 100644 api/fx/ingestor/config.local.yml create mode 100644 api/fx/oracle/config.local.yml create mode 100644 api/gateway/aurora/config.local.yml create mode 100644 api/gateway/chain/config.local.yml create mode 100644 api/gateway/chsettle/config.local.yml create mode 100644 api/gateway/mntx/config.local.yml create mode 100644 api/gateway/tgsettle/config.local.yml create mode 100644 api/gateway/tron/config.local.yml create mode 100644 api/ledger/config.local.yml create mode 100755 api/notification/config.local.yml create mode 100644 api/payments/methods/config.local.yml create mode 100644 api/payments/orchestrator/config.local.yml create mode 100644 api/payments/quotation/config.local.yml create mode 100755 ci/scripts/check-config-coherence.sh diff --git a/Makefile b/Makefile index 5ac29b7e..e8d21d25 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,7 @@ build-gateways \ build-backend \ build-frontend \ + check-configs \ up \ down \ restart \ @@ -125,6 +126,7 @@ help: @echo " make generate Generate all code (protobuf + Flutter)" @echo " make generate-backend Generate protobuf code only" @echo " make generate-frontend Generate Flutter code only" + @echo " make check-configs Validate prod/dev/local config coherence" @echo " make update Update all dependencies (Go + Flutter)" @echo " make update-backend Update Go dependencies only" @echo " make update-frontend Update Flutter dependencies only" @@ -479,6 +481,10 @@ test-frontend: @cd frontend/pweb && flutter test @echo "$(GREEN)✅ All frontend tests passed$(NC)" +# Run Go backend linting +check-configs: + @./ci/scripts/check-config-coherence.sh + # Run Go backend linting lint-backend: @echo "$(GREEN)Running backend linting...$(NC)" diff --git a/api/billing/documents/config.dev.yml b/api/billing/documents/config.dev.yml index 1d25d628..8ca05e24 100644 --- a/api/billing/documents/config.dev.yml +++ b/api/billing/documents/config.dev.yml @@ -4,7 +4,7 @@ runtime: grpc: network: tcp address: ":50061" - advertise_host: "dev-billing-documents" + advertise_host: "sendico_billing_documents" enable_reflection: true enable_health: true diff --git a/api/billing/documents/config.local.yml b/api/billing/documents/config.local.yml new file mode 100644 index 00000000..1d25d628 --- /dev/null +++ b/api/billing/documents/config.local.yml @@ -0,0 +1,48 @@ +runtime: + shutdown_timeout_seconds: 15 + +grpc: + network: tcp + address: ":50061" + advertise_host: "dev-billing-documents" + enable_reflection: true + enable_health: true + +metrics: + address: ":9409" + +database: + driver: mongodb + settings: + host_env: DOCUMENTS_MONGO_HOST + port_env: DOCUMENTS_MONGO_PORT + database_env: DOCUMENTS_MONGO_DATABASE + user_env: DOCUMENTS_MONGO_USER + password_env: DOCUMENTS_MONGO_PASSWORD + auth_source_env: DOCUMENTS_MONGO_AUTH_SOURCE + replica_set_env: DOCUMENTS_MONGO_REPLICA_SET + +documents: + issuer: + logo_path: "assets/logo.png" + templates: + acceptance_path: "templates/acceptance.tpl" + protection: + owner_password: "sendico-documents" + storage: + driver: local_fs + local: + root_path: "tmp/documents" + +messaging: + driver: NATS + settings: + url_env: NATS_URL + host_env: NATS_HOST + port_env: NATS_PORT + username_env: NATS_USER + password_env: NATS_PASSWORD + broker_name: Billing Documents Service + max_reconnects: 10 + reconnect_wait: 5 + buffer_size: 1024 diff --git a/api/billing/fees/config.dev.yml b/api/billing/fees/config.dev.yml index cb96e107..73c97c43 100644 --- a/api/billing/fees/config.dev.yml +++ b/api/billing/fees/config.dev.yml @@ -4,7 +4,7 @@ runtime: grpc: network: tcp address: ":50060" - advertise_host: "dev-billing-fees" + advertise_host: "sendico_billing_fees" enable_reflection: true enable_health: true @@ -36,7 +36,7 @@ messaging: buffer_size: 1024 oracle: - address: "dev-fx-oracle:50051" + address: "sendico_fx_oracle:50051" dial_timeout_seconds: 5 call_timeout_seconds: 3 insecure: true diff --git a/api/billing/fees/config.local.yml b/api/billing/fees/config.local.yml new file mode 100644 index 00000000..cb96e107 --- /dev/null +++ b/api/billing/fees/config.local.yml @@ -0,0 +1,42 @@ +runtime: + shutdown_timeout_seconds: 15 + +grpc: + network: tcp + address: ":50060" + advertise_host: "dev-billing-fees" + enable_reflection: true + enable_health: true + +metrics: + address: ":9402" + +database: + driver: mongodb + settings: + host_env: FEES_MONGO_HOST + port_env: FEES_MONGO_PORT + database_env: FEES_MONGO_DATABASE + user_env: FEES_MONGO_USER + password_env: FEES_MONGO_PASSWORD + auth_source_env: FEES_MONGO_AUTH_SOURCE + replica_set_env: FEES_MONGO_REPLICA_SET + +messaging: + driver: NATS + settings: + url_env: NATS_URL + host_env: NATS_HOST + port_env: NATS_PORT + username_env: NATS_USER + password_env: NATS_PASSWORD + broker_name: Billing Fees Service + max_reconnects: 10 + reconnect_wait: 5 + buffer_size: 1024 + +oracle: + address: "dev-fx-oracle:50051" + dial_timeout_seconds: 5 + call_timeout_seconds: 3 + insecure: true diff --git a/api/discovery/config.local.yml b/api/discovery/config.local.yml new file mode 100644 index 00000000..4bb17d8c --- /dev/null +++ b/api/discovery/config.local.yml @@ -0,0 +1,21 @@ +runtime: + shutdown_timeout_seconds: 15 + +metrics: + address: ":9405" + +messaging: + driver: NATS + settings: + url_env: NATS_URL + host_env: NATS_HOST + port_env: NATS_PORT + username_env: NATS_USER + password_env: NATS_PASSWORD + broker_name: Discovery Service + max_reconnects: 10 + reconnect_wait: 5 + buffer_size: 1024 + +registry: + kv_ttl_seconds: 3600 diff --git a/api/edge/bff/config.dev.yml b/api/edge/bff/config.dev.yml index f1923143..aabc756f 100755 --- a/api/edge/bff/config.dev.yml +++ b/api/edge/bff/config.dev.yml @@ -76,7 +76,7 @@ api: root_path: ./storage chain_gateway: - address: dev-tron-gateway:50071 + address: sendico_tron_gateway:50071 address_env: TRON_GATEWAY_ADDRESS dial_timeout_seconds: 5 call_timeout_seconds: 5 @@ -86,25 +86,25 @@ api: token_symbol: USDT contract_address: "" ledger: - address: dev-ledger:50052 + address: sendico_ledger:50052 address_env: LEDGER_ADDRESS dial_timeout_seconds: 5 call_timeout_seconds: 5 insecure: true payment_orchestrator: - address: dev-payments-orchestrator:50062 + address: sendico_payments_orchestrator:50062 address_env: PAYMENTS_ADDRESS dial_timeout_seconds: 5 call_timeout_seconds: 5 insecure: true payment_quotation: - address: dev-payments-quotation:50064 + address: sendico_payments_quotation:50064 address_env: PAYMENTS_QUOTE_ADDRESS dial_timeout_seconds: 5 call_timeout_seconds: 5 insecure: true payment_methods: - address: dev-payments-methods:50066 + address: sendico_payments_methods:50066 address_env: PAYMENTS_METHODS_ADDRESS dial_timeout_seconds: 5 call_timeout_seconds: 5 diff --git a/api/edge/bff/config.local.yml b/api/edge/bff/config.local.yml new file mode 100755 index 00000000..f1923143 --- /dev/null +++ b/api/edge/bff/config.local.yml @@ -0,0 +1,146 @@ +http_server: + listen_address: :8081 + read_header_timeout: 60 + shutdown_timeout: 5 + +api: + amplitude: + ampli_environment_env: AMPLI_ENVIRONMENT + middleware: + api_protocol_env: API_PROTOCOL + domain_env: SERVICE_HOST + api_endpoint_env: API_ENDPOINT + signature: + secret_key_env: API_ENDPOINT_SECRET + algorithm: HS256 + CORS: + max_age: 300 + allowed_origins: + - "*" + allowed_methods: + - "GET" + - "POST" + - "PUT" + - "PATCH" + - "DELETE" + - "OPTIONS" + allowed_headers: + - "Accept" + - "Authorization" + - "Content-Type" + - "X-Requested-With" + exposed_headers: + allow_credentials: false + websocket: + endpoint_env: WS_ENDPOINT + timeout: 60 + message_broker: + driver: NATS + settings: + url_env: NATS_URL + host_env: NATS_HOST + port_env: NATS_PORT + username_env: NATS_USER + password_env: NATS_PASSWORD + broker_name: Sendico Backend server + max_reconnects: 10 + reconnect_wait: 5 + buffer_size: 1024 + # type: in-process + # settings: + # buffer_size: 10 + token: + expiration_hours: + account: 24 + refresh: 720 + length: 32 + password: + token_length: 32 + check: + min_length: 8 + digit: true + upper: true + lower: true + special: true + + + storage: + # driver: aws_s3 + # settings: + # access_key_id_env: S3_ACCESS_KEY_ID + # secret_access_key_env: S3_ACCESS_KEY_SECRET + # region_env: S3_REGION + # bucket_name_env: S3_BUCKET_NAME + driver: local_fs + settings: + root_path: ./storage + + chain_gateway: + address: dev-tron-gateway:50071 + address_env: TRON_GATEWAY_ADDRESS + dial_timeout_seconds: 5 + call_timeout_seconds: 5 + insecure: true + default_asset: + chain: TRON_NILE + token_symbol: USDT + contract_address: "" + ledger: + address: dev-ledger:50052 + address_env: LEDGER_ADDRESS + dial_timeout_seconds: 5 + call_timeout_seconds: 5 + insecure: true + payment_orchestrator: + address: dev-payments-orchestrator:50062 + address_env: PAYMENTS_ADDRESS + dial_timeout_seconds: 5 + call_timeout_seconds: 5 + insecure: true + payment_quotation: + address: dev-payments-quotation:50064 + address_env: PAYMENTS_QUOTE_ADDRESS + dial_timeout_seconds: 5 + call_timeout_seconds: 5 + insecure: true + payment_methods: + address: dev-payments-methods:50066 + address_env: PAYMENTS_METHODS_ADDRESS + dial_timeout_seconds: 5 + call_timeout_seconds: 5 + insecure: true + callbacks: + default_event_types: + - payment.status.updated + default_status: active + secret_path_prefix: sendico/callbacks + secret_field: value + secret_length_bytes: 32 + vault: + address: "http://dev-vault:8200" + token_env: VAULT_TOKEN + token_file_env: VAULT_TOKEN_FILE + namespace: "" + mount_path: kv + +app: + +database: + driver: mongodb + settings: + host_env: MONGO_HOST + port_env: MONGO_PORT + database_env: MONGO_DATABASE + user_env: MONGO_USER + password_env: MONGO_PASSWORD + auth_source_env: MONGO_AUTH_SOURCE + replica_set_env: MONGO_REPLICA_SET + enforcer: + driver: native + settings: + model_path_env: PERMISSION_MODEL + adapter: + collection_name_env: PERMISSION_COLLECTION + database_name_env: MONGO_DATABASE + timeout_seconds_env: PERMISSION_TIMEOUT + is_filtered_env: PERMISSION_IS_FILTERED diff --git a/api/edge/callbacks/config.local.yml b/api/edge/callbacks/config.local.yml new file mode 100644 index 00000000..db6c7aa8 --- /dev/null +++ b/api/edge/callbacks/config.local.yml @@ -0,0 +1,55 @@ +runtime: + shutdown_timeout_seconds: 15 + +metrics: + address: ":9420" + +database: + driver: mongodb + settings: + host_env: CALLBACKS_MONGO_HOST + port_env: CALLBACKS_MONGO_PORT + database_env: CALLBACKS_MONGO_DATABASE + user_env: CALLBACKS_MONGO_USER + password_env: CALLBACKS_MONGO_PASSWORD + auth_source_env: CALLBACKS_MONGO_AUTH_SOURCE + replica_set_env: CALLBACKS_MONGO_REPLICA_SET + +messaging: + driver: NATS + settings: + url_env: NATS_URL + host_env: NATS_HOST + port_env: NATS_PORT + username_env: NATS_USER + password_env: NATS_PASSWORD + broker_name: Edge Callbacks Service + max_reconnects: 10 + reconnect_wait: 5 + buffer_size: 1024 + +delivery: + worker_concurrency: 8 + worker_poll_ms: 200 + lock_ttl_seconds: 30 + request_timeout_ms: 10000 + max_attempts: 8 + min_delay_ms: 1000 + max_delay_ms: 300000 + jitter_ratio: 0.2 + +security: + require_https: true + allowed_hosts: [] + allowed_ports: [443] + dns_resolve_timeout_ms: 2000 + +secrets: + cache_ttl_seconds: 60 + static: {} + vault: + address: "http://dev-vault:8200" + token_env: VAULT_TOKEN + namespace: "" + mount_path: kv + default_field: value diff --git a/api/fx/ingestor/config.local.yml b/api/fx/ingestor/config.local.yml new file mode 100644 index 00000000..9ae70b69 --- /dev/null +++ b/api/fx/ingestor/config.local.yml @@ -0,0 +1,74 @@ +poll_interval_seconds: 30 + +market: + sources: + - driver: BINANCE + settings: + base_url: "https://api.binance.com" + - driver: COINGECKO + settings: + base_url: "https://api.coingecko.com/api/v3" + - driver: CBR + settings: + base_url: "https://www.cbr.ru" + user_agent: "Mozilla/5.0 (compatible; SendicoFX/1.0; +https://app.sendico.io)" + accept_header: "application/xml,text/xml;q=0.9,*/*;q=0.8" + pairs: + BINANCE: + - base: "USDT" + quote: "EUR" + symbol: "EURUSDT" + invert: true + - base: "USDT" + quote: "USD" + symbol: "USDTUSD" + invert: false + - base: "UAH" + quote: "USDT" + symbol: "USDTUAH" + invert: true + - base: "USDC" + quote: "EUR" + symbol: "EURUSDC" + invert: true + COINGECKO: + - base: "USDT" + quote: "RUB" + symbol: "tether:rub" + CBR: + - base: "USD" + quote: "RUB" + symbol: "USD" + provider: "cbr" + - base: "EUR" + quote: "RUB" + symbol: "EUR" + provider: "cbr" + +metrics: + enabled: true + address: ":9102" + +messaging: + driver: NATS + settings: + url_env: NATS_URL + host_env: NATS_HOST + port_env: NATS_PORT + username_env: NATS_USER + password_env: NATS_PASSWORD + broker_name: FX Ingestor + max_reconnects: 10 + reconnect_wait: 5 + buffer_size: 1024 + +database: + driver: mongodb + settings: + host_env: FX_MONGO_HOST + port_env: FX_MONGO_PORT + database_env: FX_MONGO_DATABASE + user_env: FX_MONGO_USER + password_env: FX_MONGO_PASSWORD + auth_source_env: FX_MONGO_AUTH_SOURCE + replica_set_env: FX_MONGO_REPLICA_SET diff --git a/api/fx/oracle/config.dev.yml b/api/fx/oracle/config.dev.yml index b8b3b7c8..8f86ade4 100644 --- a/api/fx/oracle/config.dev.yml +++ b/api/fx/oracle/config.dev.yml @@ -4,7 +4,7 @@ runtime: grpc: network: tcp address: ":50051" - advertise_host: "dev-fx-oracle" + advertise_host: "sendico_fx_oracle" enable_reflection: true enable_health: true diff --git a/api/fx/oracle/config.local.yml b/api/fx/oracle/config.local.yml new file mode 100644 index 00000000..b8b3b7c8 --- /dev/null +++ b/api/fx/oracle/config.local.yml @@ -0,0 +1,38 @@ +runtime: + shutdown_timeout_seconds: 15 + +grpc: + network: tcp + address: ":50051" + advertise_host: "dev-fx-oracle" + enable_reflection: true + enable_health: true + +metrics: + address: ":9400" + +max_quote_ttl_ms: 600000 + +database: + driver: mongodb + settings: + host_env: FX_MONGO_HOST + port_env: FX_MONGO_PORT + database_env: FX_MONGO_DATABASE + user_env: FX_MONGO_USER + password_env: FX_MONGO_PASSWORD + auth_source_env: FX_MONGO_AUTH_SOURCE + replica_set_env: FX_MONGO_REPLICA_SET + +messaging: + driver: NATS + settings: + url_env: NATS_URL + host_env: NATS_HOST + port_env: NATS_PORT + username_env: NATS_USER + password_env: NATS_PASSWORD + broker_name: FX Oracle + max_reconnects: 10 + reconnect_wait: 5 + buffer_size: 1024 diff --git a/api/gateway/aurora/config.dev.yml b/api/gateway/aurora/config.dev.yml index 10b1ed14..6cadfaee 100644 --- a/api/gateway/aurora/config.dev.yml +++ b/api/gateway/aurora/config.dev.yml @@ -4,7 +4,7 @@ runtime: grpc: network: tcp address: ":50075" - advertise_host: "dev-aurora-gateway" + advertise_host: "sendico_aurora_gateway" enable_reflection: true enable_health: true diff --git a/api/gateway/aurora/config.local.yml b/api/gateway/aurora/config.local.yml new file mode 100644 index 00000000..10b1ed14 --- /dev/null +++ b/api/gateway/aurora/config.local.yml @@ -0,0 +1,62 @@ +runtime: + shutdown_timeout_seconds: 15 + +grpc: + network: tcp + address: ":50075" + advertise_host: "dev-aurora-gateway" + enable_reflection: true + enable_health: true + +metrics: + address: ":9405" + +database: + driver: mongodb + settings: + host_env: AURORA_GATEWAY_MONGO_HOST + port_env: AURORA_GATEWAY_MONGO_PORT + database_env: AURORA_GATEWAY_MONGO_DATABASE + user_env: AURORA_GATEWAY_MONGO_USER + password_env: AURORA_GATEWAY_MONGO_PASSWORD + auth_source_env: AURORA_GATEWAY_MONGO_AUTH_SOURCE + replica_set_env: AURORA_GATEWAY_MONGO_REPLICA_SET + +messaging: + driver: NATS + settings: + url_env: NATS_URL + host_env: NATS_HOST + port_env: NATS_PORT + username_env: NATS_USER + password_env: NATS_PASSWORD + broker_name: Aurora Gateway Service + max_reconnects: 10 + reconnect_wait: 5 + buffer_size: 1024 + +aurora: + base_url: "http://aurora-sim.local" + project_id: 1001 + secret_key: "aurora-dev-simulated" + allowed_currencies: ["RUB"] + require_customer_address: false + request_timeout_seconds: 15 + status_success: "success" + status_processing: "processing" + strict_operation_mode: false + +gateway: + id: "mcards" + is_enabled: true + network: "MIR" + currencies: ["RUB"] + limits: + per_tx_min_amount: "0" + +http: + callback: + address: ":8084" + path: "/aurora/callback" + allowed_cidrs: [] + max_body_bytes: 1048576 diff --git a/api/gateway/chain/config.dev.yml b/api/gateway/chain/config.dev.yml index d1eb9531..fd3d2c05 100644 --- a/api/gateway/chain/config.dev.yml +++ b/api/gateway/chain/config.dev.yml @@ -4,7 +4,7 @@ runtime: grpc: network: tcp address: ":50070" - advertise_host: "dev-chain-gateway" + advertise_host: "sendico_chain_gateway" enable_reflection: true enable_health: true diff --git a/api/gateway/chain/config.local.yml b/api/gateway/chain/config.local.yml new file mode 100644 index 00000000..d1eb9531 --- /dev/null +++ b/api/gateway/chain/config.local.yml @@ -0,0 +1,70 @@ +runtime: + shutdown_timeout_seconds: 15 + +grpc: + network: tcp + address: ":50070" + advertise_host: "dev-chain-gateway" + enable_reflection: true + enable_health: true + +metrics: + address: ":9406" + +database: + driver: mongodb + settings: + host_env: CHAIN_GATEWAY_MONGO_HOST + port_env: CHAIN_GATEWAY_MONGO_PORT + database_env: CHAIN_GATEWAY_MONGO_DATABASE + user_env: CHAIN_GATEWAY_MONGO_USER + password_env: CHAIN_GATEWAY_MONGO_PASSWORD + auth_source_env: CHAIN_GATEWAY_MONGO_AUTH_SOURCE + replica_set_env: CHAIN_GATEWAY_MONGO_REPLICA_SET + +messaging: + driver: NATS + settings: + url_env: NATS_URL + host_env: NATS_HOST + port_env: NATS_PORT + username_env: NATS_USER + password_env: NATS_PASSWORD + broker_name: Chain Gateway Service + max_reconnects: 10 + reconnect_wait: 5 + buffer_size: 1024 + +chains: + - name: arbitrum_sepolia + chain_id: 421614 + native_token: ETH + rpc_url_env: CHAIN_GATEWAY_RPC_URL + + gas_topup_policy: + buffer_percent: 0.20 + min_native_balance: 0.002 + rounding_unit: 0.001 + max_topup: 0.02 + + tokens: + # Test USDT (official test deployment) + - symbol: USDT + contract: "0x5c6b6d1f2f2f6d7b8a9c3e4f5a6b7c8d9e0f1234" + + # Test USDC (Circle test deployment) + - symbol: USDC + contract: "0x75faf114eafb1bdbe2f0316df893fd58ce46aa4d" + +key_management: + driver: vault + settings: + address: "http://dev-vault:8200" + token_env: VAULT_TOKEN + namespace: "" + mount_path: kv + key_prefix: gateway/chain/wallets + +cache: + wallet_balance_ttl_seconds: 120 + rpc_request_timeout_seconds: 15 diff --git a/api/gateway/chsettle/config.dev.yml b/api/gateway/chsettle/config.dev.yml index b68a6f50..acde7bd0 100644 --- a/api/gateway/chsettle/config.dev.yml +++ b/api/gateway/chsettle/config.dev.yml @@ -4,7 +4,7 @@ runtime: grpc: network: tcp address: ":50080" - advertise_host: "dev-chsettle-gateway" + advertise_host: "sendico_chsettle_gateway" enable_reflection: true enable_health: true diff --git a/api/gateway/chsettle/config.local.yml b/api/gateway/chsettle/config.local.yml new file mode 100644 index 00000000..b68a6f50 --- /dev/null +++ b/api/gateway/chsettle/config.local.yml @@ -0,0 +1,52 @@ +runtime: + shutdown_timeout_seconds: 15 + +grpc: + network: tcp + address: ":50080" + advertise_host: "dev-chsettle-gateway" + enable_reflection: true + enable_health: true + +metrics: + address: ":9406" + +database: + driver: mongodb + settings: + host_env: CHSETTLE_GATEWAY_MONGO_HOST + port_env: CHSETTLE_GATEWAY_MONGO_PORT + database_env: CHSETTLE_GATEWAY_MONGO_DATABASE + user_env: CHSETTLE_GATEWAY_MONGO_USER + password_env: CHSETTLE_GATEWAY_MONGO_PASSWORD + auth_source_env: CHSETTLE_GATEWAY_MONGO_AUTH_SOURCE + replica_set_env: CHSETTLE_GATEWAY_MONGO_REPLICA_SET + +messaging: + driver: NATS + settings: + url_env: NATS_URL + host_env: NATS_HOST + port_env: NATS_PORT + username_env: NATS_USER + password_env: NATS_PASSWORD + broker_name: ChimeraSettle Gateway Service + max_reconnects: 10 + reconnect_wait: 5 + buffer_size: 1024 + +gateway: + rail: "SETTLEMENT" + target_chat_id_env: CHSETTLE_GATEWAY_CHAT_ID + timeout_seconds: 345600 + accepted_user_ids: [] + success_reaction: "\U0001FAE1" + +treasury: + execution_delay: 60s + poll_interval: 60s + ledger: + timeout: 5s + limits: + max_amount_per_operation: "1000000" + max_daily_amount: "5000000" diff --git a/api/gateway/mntx/config.dev.yml b/api/gateway/mntx/config.dev.yml index e5b2b5ed..c1623d21 100644 --- a/api/gateway/mntx/config.dev.yml +++ b/api/gateway/mntx/config.dev.yml @@ -4,7 +4,7 @@ runtime: grpc: network: tcp address: ":50075" - advertise_host: "dev-mntx-gateway" + advertise_host: "sendico_mntx_gateway" enable_reflection: true enable_health: true diff --git a/api/gateway/mntx/config.local.yml b/api/gateway/mntx/config.local.yml new file mode 100644 index 00000000..e5b2b5ed --- /dev/null +++ b/api/gateway/mntx/config.local.yml @@ -0,0 +1,62 @@ +runtime: + shutdown_timeout_seconds: 15 + +grpc: + network: tcp + address: ":50075" + advertise_host: "dev-mntx-gateway" + enable_reflection: true + enable_health: true + +metrics: + address: ":9404" + +database: + driver: mongodb + settings: + host_env: MNTX_GATEWAY_MONGO_HOST + port_env: MNTX_GATEWAY_MONGO_PORT + database_env: MNTX_GATEWAY_MONGO_DATABASE + user_env: MNTX_GATEWAY_MONGO_USER + password_env: MNTX_GATEWAY_MONGO_PASSWORD + auth_source_env: MNTX_GATEWAY_MONGO_AUTH_SOURCE + replica_set_env: MNTX_GATEWAY_MONGO_REPLICA_SET + +messaging: + driver: NATS + settings: + url_env: NATS_URL + host_env: NATS_HOST + port_env: NATS_PORT + username_env: NATS_USER + password_env: NATS_PASSWORD + broker_name: Monetix Gateway Service + max_reconnects: 10 + reconnect_wait: 5 + buffer_size: 1024 + +mcards: + base_url_env: MONETIX_BASE_URL + project_id_env: MONETIX_PROJECT_ID + secret_key_env: MONETIX_SECRET_KEY + allowed_currencies: ["RUB"] + require_customer_address: false + request_timeout_seconds: 15 + status_success: "success" + status_processing: "processing" + strict_operation_mode: false + +gateway: + id: "mcards" + is_enabled: true + network: "MIR" + currencies: ["RUB"] + limits: + per_tx_min_amount: "0" + +http: + callback: + address: ":8084" + path: "/monetix/callback" + allowed_cidrs: [] + max_body_bytes: 1048576 diff --git a/api/gateway/tgsettle/config.dev.yml b/api/gateway/tgsettle/config.dev.yml index 941fd6d4..03834aca 100644 --- a/api/gateway/tgsettle/config.dev.yml +++ b/api/gateway/tgsettle/config.dev.yml @@ -4,7 +4,7 @@ runtime: grpc: network: tcp address: ":50080" - advertise_host: "dev-tgsettle-gateway" + advertise_host: "sendico_tgsettle_gateway" enable_reflection: true enable_health: true diff --git a/api/gateway/tgsettle/config.local.yml b/api/gateway/tgsettle/config.local.yml new file mode 100644 index 00000000..941fd6d4 --- /dev/null +++ b/api/gateway/tgsettle/config.local.yml @@ -0,0 +1,52 @@ +runtime: + shutdown_timeout_seconds: 15 + +grpc: + network: tcp + address: ":50080" + advertise_host: "dev-tgsettle-gateway" + enable_reflection: true + enable_health: true + +metrics: + address: ":9406" + +database: + driver: mongodb + settings: + host_env: TGSETTLE_GATEWAY_MONGO_HOST + port_env: TGSETTLE_GATEWAY_MONGO_PORT + database_env: TGSETTLE_GATEWAY_MONGO_DATABASE + user_env: TGSETTLE_GATEWAY_MONGO_USER + password_env: TGSETTLE_GATEWAY_MONGO_PASSWORD + auth_source_env: TGSETTLE_GATEWAY_MONGO_AUTH_SOURCE + replica_set_env: TGSETTLE_GATEWAY_MONGO_REPLICA_SET + +messaging: + driver: NATS + settings: + url_env: NATS_URL + host_env: NATS_HOST + port_env: NATS_PORT + username_env: NATS_USER + password_env: NATS_PASSWORD + broker_name: TGSettle Gateway Service + max_reconnects: 10 + reconnect_wait: 5 + buffer_size: 1024 + +gateway: + rail: "SETTLEMENT" + target_chat_id_env: TGSETTLE_GATEWAY_CHAT_ID + timeout_seconds: 345600 + accepted_user_ids: [] + success_reaction: "\U0001FAE1" + +treasury: + execution_delay: 60s + poll_interval: 60s + ledger: + timeout: 5s + limits: + max_amount_per_operation: "1000000" + max_daily_amount: "5000000" diff --git a/api/gateway/tron/config.dev.yml b/api/gateway/tron/config.dev.yml index 1c6660f7..53531ae2 100644 --- a/api/gateway/tron/config.dev.yml +++ b/api/gateway/tron/config.dev.yml @@ -4,7 +4,7 @@ runtime: grpc: network: tcp address: ":50071" - advertise_host: "dev-tron-gateway" + advertise_host: "sendico_tron_gateway" enable_reflection: true enable_health: true diff --git a/api/gateway/tron/config.local.yml b/api/gateway/tron/config.local.yml new file mode 100644 index 00000000..1c6660f7 --- /dev/null +++ b/api/gateway/tron/config.local.yml @@ -0,0 +1,67 @@ +runtime: + shutdown_timeout_seconds: 15 + +grpc: + network: tcp + address: ":50071" + advertise_host: "dev-tron-gateway" + enable_reflection: true + enable_health: true + +metrics: + address: ":9408" + +database: + driver: mongodb + settings: + host_env: TRON_GATEWAY_MONGO_HOST + port_env: TRON_GATEWAY_MONGO_PORT + database_env: TRON_GATEWAY_MONGO_DATABASE + user_env: TRON_GATEWAY_MONGO_USER + password_env: TRON_GATEWAY_MONGO_PASSWORD + auth_source_env: TRON_GATEWAY_MONGO_AUTH_SOURCE + replica_set_env: TRON_GATEWAY_MONGO_REPLICA_SET + +messaging: + driver: NATS + settings: + url_env: NATS_URL + host_env: NATS_HOST + port_env: NATS_PORT + username_env: NATS_USER + password_env: NATS_PASSWORD + broker_name: TRON Gateway Service + max_reconnects: 10 + reconnect_wait: 5 + buffer_size: 1024 + +chains: + - name: tron_nile + chain_id: 3448148188 # Nile testnet + native_token: TRX + rpc_url_env: TRON_GATEWAY_RPC_URL + grpc: + url_env: TRON_GATEWAY_GRPC_URL + token_env: TRON_GATEWAY_GRPC_TOKEN + force_ipv4: false + gas_topup_policy: + buffer_percent: 0.10 + min_native_balance_trx: 10 + rounding_unit_trx: 1 + max_topup_trx: 100 + tokens: + - symbol: USDT + contract: "TXYZopYRdj2D9XRtbG411XZZ3kM5VkAeBf" + +key_management: + driver: vault + settings: + address: "http://dev-vault:8200" + token_env: VAULT_TOKEN + namespace: "" + mount_path: kv + key_prefix: gateway/tron/wallets + +cache: + wallet_balance_ttl_seconds: 120 + rpc_request_timeout_seconds: 15 diff --git a/api/ledger/config.dev.yml b/api/ledger/config.dev.yml index 0f8379cb..bbf2f8df 100644 --- a/api/ledger/config.dev.yml +++ b/api/ledger/config.dev.yml @@ -4,7 +4,7 @@ runtime: grpc: network: tcp address: ":50052" - advertise_host: "dev-ledger" + advertise_host: "sendico_ledger" enable_reflection: true enable_health: true diff --git a/api/ledger/config.local.yml b/api/ledger/config.local.yml new file mode 100644 index 00000000..0f8379cb --- /dev/null +++ b/api/ledger/config.local.yml @@ -0,0 +1,42 @@ +runtime: + shutdown_timeout_seconds: 15 + +grpc: + network: tcp + address: ":50052" + advertise_host: "dev-ledger" + enable_reflection: true + enable_health: true + +metrics: + address: ":9401" + +database: + driver: mongodb + settings: + host_env: LEDGER_MONGO_HOST + port_env: LEDGER_MONGO_PORT + database_env: LEDGER_MONGO_DATABASE + user_env: LEDGER_MONGO_USER + password_env: LEDGER_MONGO_PASSWORD + auth_source_env: LEDGER_MONGO_AUTH_SOURCE + replica_set_env: LEDGER_MONGO_REPLICA_SET + +messaging: + driver: NATS + settings: + url_env: NATS_URL + host_env: NATS_HOST + port_env: NATS_PORT + username_env: NATS_USER + password_env: NATS_PASSWORD + broker_name: Ledger Service + max_reconnects: 10 + reconnect_wait: 5 + buffer_size: 1024 + # Optional: remove this block to use package defaults. + reliable_publisher: + enabled: true + batch_size: 100 + poll_interval_seconds: 1 + max_attempts: 5 diff --git a/api/notification/config.local.yml b/api/notification/config.local.yml new file mode 100755 index 00000000..0630f102 --- /dev/null +++ b/api/notification/config.local.yml @@ -0,0 +1,94 @@ +http_server: + listen_address: :8081 + read_header_timeout: 60 + shutdown_timeout: 5 + +api: + amplitude: + ampli_environment_env: AMPLI_ENVIRONMENT + middleware: + api_protocol_env: API_PROTOCOL + domain_env: SERVICE_HOST + api_endpoint_env: API_ENDPOINT + signature: + secret_key_env: API_ENDPOINT_SECRET + algorithm: HS256 + CORS: + max_age: 300 + allowed_origins: + - "http://*" + - "https://*" + allowed_methods: + - "GET" + - "POST" + - "PATCH" + - "DELETE" + - "OPTIONS" + allowed_headers: + - "Accept" + - "Authorization" + - "Content-Type" + exposed_headers: + allow_credentials: false + websocket: + endpoint_env: WS_ENDPOINT + timeout: 60 + message_broker: + driver: NATS + settings: + url_env: NATS_URL + host_env: NATS_HOST + port_env: NATS_PORT + username_env: NATS_USER + password_env: NATS_PASSWORD + broker_name: Sendico Notification server + max_reconnects: 10 + reconnect_wait: 5 + buffer_size: 1024 + # type: in-process + # settings: + # buffer_size: 10 + notification: + driver: client + settings: + username_env: MAIL_USER + password_env: MAIL_SECRET + host: "mail.sendico.io" + port: 465 + from: "Sendico Tech" + network_timeout: 10 + telegram: + bot_token_env: TELEGRAM_BOT_TOKEN + chat_id_env: TELEGRAM_CHAT_ID + thread_id_env: TELEGRAM_THREAD_ID + api_url: "https://api.telegram.org" + timeout_seconds: 10 + parse_mode: markdown + +localizer: + path: "./i18n" + languages: ["en", "ru"] + service_name: "Sendico" + support: "support@sendico.io" + +app: + +database: + driver: mongodb + settings: + host_env: MONGO_HOST + port_env: MONGO_PORT + database_env: MONGO_DATABASE + user_env: MONGO_USER + password_env: MONGO_PASSWORD + auth_source_env: MONGO_AUTH_SOURCE + replica_set_env: MONGO_REPLICA_SET + enforcer: + driver: native + settings: + model_path_env: PERMISSION_MODEL + adapter: + collection_name_env: PERMISSION_COLLECTION + database_name_env: MONGO_DATABASE + timeout_seconds_env: PERMISSION_TIMEOUT + is_filtered_env: PERMISSION_IS_FILTERED diff --git a/api/payments/methods/config.dev.yml b/api/payments/methods/config.dev.yml index ee32ba01..966a7890 100644 --- a/api/payments/methods/config.dev.yml +++ b/api/payments/methods/config.dev.yml @@ -4,7 +4,7 @@ runtime: grpc: network: tcp address: ":50066" - advertise_host: "dev-payments-methods" + advertise_host: "sendico_payments_methods" enable_reflection: true enable_health: true diff --git a/api/payments/methods/config.local.yml b/api/payments/methods/config.local.yml new file mode 100644 index 00000000..ee32ba01 --- /dev/null +++ b/api/payments/methods/config.local.yml @@ -0,0 +1,49 @@ +runtime: + shutdown_timeout_seconds: 15 + +grpc: + network: tcp + address: ":50066" + advertise_host: "dev-payments-methods" + enable_reflection: true + enable_health: true + +metrics: + address: ":9416" + +messaging: + driver: NATS + settings: + url_env: NATS_URL + host_env: NATS_HOST + port_env: NATS_PORT + username_env: NATS_USER + password_env: NATS_PASSWORD + broker_name: Payments Methods Service + max_reconnects: 10 + reconnect_wait: 5 + buffer_size: 1024 + +database: + driver: mongodb + settings: + host_env: PAYMENTS_MONGO_HOST + port_env: PAYMENTS_MONGO_PORT + database_env: PAYMENTS_MONGO_DATABASE + user_env: PAYMENTS_MONGO_USER + password_env: PAYMENTS_MONGO_PASSWORD + auth_source_env: PAYMENTS_MONGO_AUTH_SOURCE + replica_set_env: PAYMENTS_MONGO_REPLICA_SET + +permissions_database: + driver: mongodb + settings: + host_env: MONGO_HOST + port_env: MONGO_PORT + database_env: MONGO_DATABASE + user_env: MONGO_USER + password_env: MONGO_PASSWORD + auth_source_env: MONGO_AUTH_SOURCE + replica_set_env: MONGO_REPLICA_SET + enforcer: + driver: native diff --git a/api/payments/orchestrator/config.dev.yml b/api/payments/orchestrator/config.dev.yml index 4714b942..a9e59777 100644 --- a/api/payments/orchestrator/config.dev.yml +++ b/api/payments/orchestrator/config.dev.yml @@ -4,7 +4,7 @@ runtime: grpc: network: tcp address: ":50062" - advertise_host: "dev-payments-orchestrator" + advertise_host: "sendico_payments_orchestrator" enable_reflection: true enable_health: true diff --git a/api/payments/orchestrator/config.local.yml b/api/payments/orchestrator/config.local.yml new file mode 100644 index 00000000..4714b942 --- /dev/null +++ b/api/payments/orchestrator/config.local.yml @@ -0,0 +1,61 @@ +runtime: + shutdown_timeout_seconds: 15 + +grpc: + network: tcp + address: ":50062" + advertise_host: "dev-payments-orchestrator" + enable_reflection: true + enable_health: true + +metrics: + address: ":9403" + +database: + driver: mongodb + settings: + host_env: PAYMENTS_MONGO_HOST + port_env: PAYMENTS_MONGO_PORT + database_env: PAYMENTS_MONGO_DATABASE + user_env: PAYMENTS_MONGO_USER + password_env: PAYMENTS_MONGO_PASSWORD + auth_source_env: PAYMENTS_MONGO_AUTH_SOURCE + replica_set_env: PAYMENTS_MONGO_REPLICA_SET + +messaging: + driver: NATS + settings: + url_env: NATS_URL + host_env: NATS_HOST + port_env: NATS_PORT + username_env: NATS_USER + password_env: NATS_PASSWORD + broker_name: Payments Orchestrator Service + max_reconnects: 10 + reconnect_wait: 5 + buffer_size: 1024 + +# Retain quote records after expiry to allow long-running payments to complete. +quote_retention_hours: 72 + +# Service endpoints are sourced from discovery; no static overrides. +card_gateways: + mcards: + funding_address: "TUaWaCkiXwYPKm5qjcB27Lhwv976vPvedE" + fee_wallet_ref: "697a062a248dc785125ccb9e" + +# Batch optimizer settings: +# - default_mode disables aggregation for unmatched traffic +# - crypto rule enables aggregation by operation destination for crypto operations +optimizer: + aggregation: + default_mode: "no_optimization" + rules: + - id: "crypto_by_destination" + priority: 100 + mode: "merge_by_destination" + group_by: "rail_target" + match: + rail: "CRYPTO" + +# Gateway instances and capabilities are sourced from service discovery. diff --git a/api/payments/quotation/config.dev.yml b/api/payments/quotation/config.dev.yml index b93037e3..6fa39188 100644 --- a/api/payments/quotation/config.dev.yml +++ b/api/payments/quotation/config.dev.yml @@ -4,7 +4,7 @@ runtime: grpc: network: tcp address: ":50064" - advertise_host: "dev-payments-quotation" + advertise_host: "sendico_payments_quotation" enable_reflection: true enable_health: true @@ -36,14 +36,14 @@ database: replica_set_env: PAYMENTS_MONGO_REPLICA_SET fees: - address: dev-billing-fees:50060 + address: sendico_billing_fees:50060 address_env: FEES_ADDRESS dial_timeout_seconds: 5 call_timeout_seconds: 5 insecure: true oracle: - address: dev-fx-oracle:50051 + address: sendico_fx_oracle:50051 address_env: ORACLE_ADDRESS dial_timeout_seconds: 5 call_timeout_seconds: 5 diff --git a/api/payments/quotation/config.local.yml b/api/payments/quotation/config.local.yml new file mode 100644 index 00000000..b93037e3 --- /dev/null +++ b/api/payments/quotation/config.local.yml @@ -0,0 +1,52 @@ +runtime: + shutdown_timeout_seconds: 15 + +grpc: + network: tcp + address: ":50064" + advertise_host: "dev-payments-quotation" + enable_reflection: true + enable_health: true + +metrics: + address: ":9414" + +messaging: + driver: NATS + settings: + url_env: NATS_URL + host_env: NATS_HOST + port_env: NATS_PORT + username_env: NATS_USER + password_env: NATS_PASSWORD + broker_name: Payments Quotation Service + max_reconnects: 10 + reconnect_wait: 5 + buffer_size: 1024 + +database: + driver: mongodb + settings: + host_env: PAYMENTS_MONGO_HOST + port_env: PAYMENTS_MONGO_PORT + database_env: PAYMENTS_MONGO_DATABASE + user_env: PAYMENTS_MONGO_USER + password_env: PAYMENTS_MONGO_PASSWORD + auth_source_env: PAYMENTS_MONGO_AUTH_SOURCE + replica_set_env: PAYMENTS_MONGO_REPLICA_SET + +fees: + address: dev-billing-fees:50060 + address_env: FEES_ADDRESS + dial_timeout_seconds: 5 + call_timeout_seconds: 5 + insecure: true + +oracle: + address: dev-fx-oracle:50051 + address_env: ORACLE_ADDRESS + dial_timeout_seconds: 5 + call_timeout_seconds: 5 + insecure: true + +quote_retention_hours: 72 diff --git a/ci/prod/compose/aurora_gateway.dockerfile b/ci/prod/compose/aurora_gateway.dockerfile index 40151a7d..c3f0cc35 100644 --- a/ci/prod/compose/aurora_gateway.dockerfile +++ b/ci/prod/compose/aurora_gateway.dockerfile @@ -28,9 +28,10 @@ RUN --mount=type=cache,target=/root/.cache/go-build \ -o /out/aurora-gateway . FROM alpine:latest AS runtime +ARG APP_CONFIG_PATH=api/gateway/aurora/config.yml RUN apk add --no-cache ca-certificates tzdata wget WORKDIR /app -COPY api/gateway/aurora/config.yml /app/config.yml +COPY ${APP_CONFIG_PATH} /app/config.yml COPY --from=build /out/aurora-gateway /app/aurora-gateway EXPOSE 50075 9404 8084 ENTRYPOINT ["/app/aurora-gateway"] diff --git a/ci/prod/compose/billing_documents.dockerfile b/ci/prod/compose/billing_documents.dockerfile index 9abd498e..9e02f07e 100644 --- a/ci/prod/compose/billing_documents.dockerfile +++ b/ci/prod/compose/billing_documents.dockerfile @@ -28,9 +28,10 @@ RUN --mount=type=cache,target=/root/.cache/go-build \ -o /out/billing-documents . FROM alpine:latest AS runtime +ARG APP_CONFIG_PATH=api/billing/documents/config.yml RUN apk add --no-cache ca-certificates tzdata wget WORKDIR /app -COPY api/billing/documents/config.yml /app/config.yml +COPY ${APP_CONFIG_PATH} /app/config.yml COPY api/billing/documents/templates /app/templates COPY api/billing/documents/assets /app/assets COPY --from=build /out/billing-documents /app/billing-documents diff --git a/ci/prod/compose/billing_fees.dockerfile b/ci/prod/compose/billing_fees.dockerfile index 0e399ea1..2fd63ccd 100644 --- a/ci/prod/compose/billing_fees.dockerfile +++ b/ci/prod/compose/billing_fees.dockerfile @@ -28,9 +28,10 @@ RUN --mount=type=cache,target=/root/.cache/go-build \ -o /out/billing-fees . FROM alpine:latest AS runtime +ARG APP_CONFIG_PATH=api/billing/fees/config.yml RUN apk add --no-cache ca-certificates tzdata wget WORKDIR /app -COPY api/billing/fees/config.yml /app/config.yml +COPY ${APP_CONFIG_PATH} /app/config.yml COPY --from=build /out/billing-fees /app/billing-fees EXPOSE 50060 9402 ENTRYPOINT ["/app/billing-fees"] diff --git a/ci/prod/compose/chsettle_gateway.dockerfile b/ci/prod/compose/chsettle_gateway.dockerfile index 45872e4a..c857c89f 100644 --- a/ci/prod/compose/chsettle_gateway.dockerfile +++ b/ci/prod/compose/chsettle_gateway.dockerfile @@ -28,9 +28,10 @@ RUN --mount=type=cache,target=/root/.cache/go-build \ -o /out/chsettle-gateway . FROM alpine:latest AS runtime +ARG APP_CONFIG_PATH=api/gateway/chsettle/config.yml RUN apk add --no-cache ca-certificates tzdata wget WORKDIR /app -COPY api/gateway/chsettle/config.yml /app/config.yml +COPY ${APP_CONFIG_PATH} /app/config.yml COPY --from=build /out/chsettle-gateway /app/chsettle-gateway EXPOSE 50080 9406 ENTRYPOINT ["/app/chsettle-gateway"] diff --git a/ci/prod/compose/discovery.dockerfile b/ci/prod/compose/discovery.dockerfile index 3ad2a511..a22d05a7 100644 --- a/ci/prod/compose/discovery.dockerfile +++ b/ci/prod/compose/discovery.dockerfile @@ -28,9 +28,10 @@ RUN --mount=type=cache,target=/root/.cache/go-build \ -o /out/discovery . FROM alpine:latest AS runtime +ARG APP_CONFIG_PATH=api/discovery/config.yml RUN apk add --no-cache ca-certificates tzdata wget WORKDIR /app -COPY api/discovery/config.yml /app/config.yml +COPY ${APP_CONFIG_PATH} /app/config.yml COPY --from=build /out/discovery /app/discovery EXPOSE 9405 ENTRYPOINT ["/app/discovery"] diff --git a/ci/prod/compose/fx_ingestor.dockerfile b/ci/prod/compose/fx_ingestor.dockerfile index fca66bc0..071279de 100644 --- a/ci/prod/compose/fx_ingestor.dockerfile +++ b/ci/prod/compose/fx_ingestor.dockerfile @@ -28,9 +28,10 @@ RUN --mount=type=cache,target=/root/.cache/go-build \ -o /out/fx-ingestor . FROM alpine:latest AS runtime +ARG APP_CONFIG_PATH=api/fx/ingestor/config.yml RUN apk add --no-cache ca-certificates tzdata wget WORKDIR /app -COPY api/fx/ingestor/config.yml /app/config.yml +COPY ${APP_CONFIG_PATH} /app/config.yml COPY --from=build /out/fx-ingestor /app/fx-ingestor EXPOSE 9102 ENTRYPOINT ["/app/fx-ingestor"] diff --git a/ci/prod/compose/fx_oracle.dockerfile b/ci/prod/compose/fx_oracle.dockerfile index 4ea7bb39..211dc7e4 100644 --- a/ci/prod/compose/fx_oracle.dockerfile +++ b/ci/prod/compose/fx_oracle.dockerfile @@ -28,9 +28,10 @@ RUN --mount=type=cache,target=/root/.cache/go-build \ -o /out/fx-oracle . FROM alpine:latest AS runtime +ARG APP_CONFIG_PATH=api/fx/oracle/config.yml RUN apk add --no-cache ca-certificates tzdata wget WORKDIR /app -COPY api/fx/oracle/config.yml /app/config.yml +COPY ${APP_CONFIG_PATH} /app/config.yml COPY --from=build /out/fx-oracle /app/fx-oracle EXPOSE 50051 9400 ENTRYPOINT ["/app/fx-oracle"] diff --git a/ci/prod/compose/ledger.dockerfile b/ci/prod/compose/ledger.dockerfile index 32e3cb86..25d7db5a 100644 --- a/ci/prod/compose/ledger.dockerfile +++ b/ci/prod/compose/ledger.dockerfile @@ -28,9 +28,10 @@ RUN --mount=type=cache,target=/root/.cache/go-build \ -o /out/ledger . FROM alpine:latest AS runtime +ARG APP_CONFIG_PATH=api/ledger/config.yml RUN apk add --no-cache ca-certificates tzdata wget WORKDIR /app -COPY api/ledger/config.yml /app/config.yml +COPY ${APP_CONFIG_PATH} /app/config.yml COPY --from=build /out/ledger /app/ledger EXPOSE 50052 9401 ENTRYPOINT ["/app/ledger"] diff --git a/ci/prod/compose/mntx_gateway.dockerfile b/ci/prod/compose/mntx_gateway.dockerfile index 727c3588..9cfb0d19 100644 --- a/ci/prod/compose/mntx_gateway.dockerfile +++ b/ci/prod/compose/mntx_gateway.dockerfile @@ -28,9 +28,10 @@ RUN --mount=type=cache,target=/root/.cache/go-build \ -o /out/mntx-gateway . FROM alpine:latest AS runtime +ARG APP_CONFIG_PATH=api/gateway/mntx/config.yml RUN apk add --no-cache ca-certificates tzdata wget WORKDIR /app -COPY api/gateway/mntx/config.yml /app/config.yml +COPY ${APP_CONFIG_PATH} /app/config.yml COPY api/gateway/mntx/entrypoint.sh /app/entrypoint.sh COPY --from=build /out/mntx-gateway /app/mntx-gateway RUN chmod +x /app/entrypoint.sh diff --git a/ci/prod/compose/notification.dockerfile b/ci/prod/compose/notification.dockerfile index 2a288d9d..0d08ec75 100644 --- a/ci/prod/compose/notification.dockerfile +++ b/ci/prod/compose/notification.dockerfile @@ -28,9 +28,10 @@ RUN --mount=type=cache,target=/root/.cache/go-build \ -o /out/notification . FROM alpine:latest AS runtime +ARG APP_CONFIG_PATH=api/notification/config.yml RUN apk add --no-cache ca-certificates tzdata wget WORKDIR /app -COPY api/notification/config.yml /app/config.yml +COPY ${APP_CONFIG_PATH} /app/config.yml COPY api/notification/i18n /app/i18n COPY api/notification/env /app/env COPY api/pkg/auth/internal/casbin/models/auth.conf /app/env/permissions_model.conf diff --git a/ci/prod/compose/payments_methods.dockerfile b/ci/prod/compose/payments_methods.dockerfile index 0aa44b10..38399ada 100644 --- a/ci/prod/compose/payments_methods.dockerfile +++ b/ci/prod/compose/payments_methods.dockerfile @@ -28,9 +28,10 @@ RUN --mount=type=cache,target=/root/.cache/go-build \ -o /out/payments-methods . FROM alpine:latest AS runtime +ARG APP_CONFIG_PATH=api/payments/methods/config.yml RUN apk add --no-cache ca-certificates tzdata wget WORKDIR /app -COPY api/payments/methods/config.yml /app/config.yml +COPY ${APP_CONFIG_PATH} /app/config.yml COPY --from=build /out/payments-methods /app/payments-methods EXPOSE 50066 9416 ENTRYPOINT ["/app/payments-methods"] diff --git a/ci/prod/compose/payments_orchestrator.dockerfile b/ci/prod/compose/payments_orchestrator.dockerfile index 613f5aac..aac8016b 100644 --- a/ci/prod/compose/payments_orchestrator.dockerfile +++ b/ci/prod/compose/payments_orchestrator.dockerfile @@ -28,9 +28,10 @@ RUN --mount=type=cache,target=/root/.cache/go-build \ -o /out/payments-orchestrator . FROM alpine:latest AS runtime +ARG APP_CONFIG_PATH=api/payments/orchestrator/config.yml RUN apk add --no-cache ca-certificates tzdata wget WORKDIR /app -COPY api/payments/orchestrator/config.yml /app/config.yml +COPY ${APP_CONFIG_PATH} /app/config.yml COPY --from=build /out/payments-orchestrator /app/payments-orchestrator EXPOSE 50062 9403 ENTRYPOINT ["/app/payments-orchestrator"] diff --git a/ci/prod/compose/payments_quotation.dockerfile b/ci/prod/compose/payments_quotation.dockerfile index 702faef5..b791f491 100644 --- a/ci/prod/compose/payments_quotation.dockerfile +++ b/ci/prod/compose/payments_quotation.dockerfile @@ -28,9 +28,10 @@ RUN --mount=type=cache,target=/root/.cache/go-build \ -o /out/payments-quotation . FROM alpine:latest AS runtime +ARG APP_CONFIG_PATH=api/payments/quotation/config.yml RUN apk add --no-cache ca-certificates tzdata wget WORKDIR /app -COPY api/payments/quotation/config.yml /app/config.yml +COPY ${APP_CONFIG_PATH} /app/config.yml COPY --from=build /out/payments-quotation /app/payments-quotation EXPOSE 50064 9414 ENTRYPOINT ["/app/payments-quotation"] diff --git a/ci/prod/compose/tgsettle_gateway.dockerfile b/ci/prod/compose/tgsettle_gateway.dockerfile index fb46a4d5..e66f52ff 100644 --- a/ci/prod/compose/tgsettle_gateway.dockerfile +++ b/ci/prod/compose/tgsettle_gateway.dockerfile @@ -28,9 +28,10 @@ RUN --mount=type=cache,target=/root/.cache/go-build \ -o /out/tgsettle-gateway . FROM alpine:latest AS runtime +ARG APP_CONFIG_PATH=api/gateway/tgsettle/config.yml RUN apk add --no-cache ca-certificates tzdata wget WORKDIR /app -COPY api/gateway/tgsettle/config.yml /app/config.yml +COPY ${APP_CONFIG_PATH} /app/config.yml COPY --from=build /out/tgsettle-gateway /app/tgsettle-gateway EXPOSE 50080 9406 ENTRYPOINT ["/app/tgsettle-gateway"] diff --git a/ci/scripts/aurora/build-image.sh b/ci/scripts/aurora/build-image.sh index 90253405..8c4924a5 100644 --- a/ci/scripts/aurora/build-image.sh +++ b/ci/scripts/aurora/build-image.sh @@ -37,6 +37,7 @@ AURORA_GATEWAY_ENV_NAME="${AURORA_GATEWAY_ENV:-$(resolve_runtime_env_name)}" load_runtime_env_bundle "${AURORA_GATEWAY_ENV_NAME}" IMAGE_TAG="$(compute_image_tag)" +AURORA_GATEWAY_CONFIG_PATH="$(resolve_app_config_path "api/gateway/aurora/config.yml")" REGISTRY_URL="${REGISTRY_URL:?missing REGISTRY_URL}" APP_V="${APP_V:?missing APP_V}" @@ -86,6 +87,7 @@ fi --context "${BUILD_CONTEXT}" \ --dockerfile "${AURORA_GATEWAY_DOCKERFILE}" \ --destination "${REGISTRY_URL}/${AURORA_GATEWAY_IMAGE_PATH}:${IMAGE_TAG}" \ + --build-arg APP_CONFIG_PATH="${AURORA_GATEWAY_CONFIG_PATH}" \ --build-arg APP_VERSION="${APP_V}" \ --build-arg GIT_REV="${GIT_REV}" \ --build-arg BUILD_BRANCH="${BUILD_BRANCH}" \ diff --git a/ci/scripts/bff/build-image.sh b/ci/scripts/bff/build-image.sh index c2848c4a..c16373e4 100755 --- a/ci/scripts/bff/build-image.sh +++ b/ci/scripts/bff/build-image.sh @@ -37,10 +37,7 @@ BFF_ENV_NAME="${BFF_ENV:-$(resolve_runtime_env_name)}" load_runtime_env_bundle "${BFF_ENV_NAME}" IMAGE_TAG="$(compute_image_tag)" -BFF_CONFIG_PATH="api/edge/bff/config.yml" -if [ "${CI_RUNTIME_ENV_NAME:-prod}" = "devserver" ] && [ -f "${REPO_ROOT}/api/edge/bff/config.dev.yml" ]; then - BFF_CONFIG_PATH="api/edge/bff/config.dev.yml" -fi +BFF_CONFIG_PATH="$(resolve_app_config_path "api/edge/bff/config.yml")" REGISTRY_URL="${REGISTRY_URL:?missing REGISTRY_URL}" APP_V="${APP_V:?missing APP_V}" diff --git a/ci/scripts/billing_documents/build-image.sh b/ci/scripts/billing_documents/build-image.sh index ba967131..cbeadda1 100755 --- a/ci/scripts/billing_documents/build-image.sh +++ b/ci/scripts/billing_documents/build-image.sh @@ -37,6 +37,7 @@ DOCUMENTS_ENV_NAME="${DOCUMENTS_ENV:-$(resolve_runtime_env_name)}" load_runtime_env_bundle "${DOCUMENTS_ENV_NAME}" IMAGE_TAG="$(compute_image_tag)" +DOCUMENTS_CONFIG_PATH="$(resolve_app_config_path "api/billing/documents/config.yml")" REGISTRY_URL="${REGISTRY_URL:?missing REGISTRY_URL}" APP_V="${APP_V:?missing APP_V}" @@ -69,6 +70,7 @@ fi --context "${BUILD_CONTEXT}" \ --dockerfile "${DOCUMENTS_DOCKERFILE}" \ --destination "${REGISTRY_URL}/${DOCUMENTS_IMAGE_PATH}:${IMAGE_TAG}" \ + --build-arg APP_CONFIG_PATH="${DOCUMENTS_CONFIG_PATH}" \ --build-arg APP_VERSION="${APP_V}" \ --build-arg GIT_REV="${GIT_REV}" \ --build-arg BUILD_BRANCH="${BUILD_BRANCH}" \ diff --git a/ci/scripts/billing_fees/build-image.sh b/ci/scripts/billing_fees/build-image.sh index 4ab659ac..705960a4 100644 --- a/ci/scripts/billing_fees/build-image.sh +++ b/ci/scripts/billing_fees/build-image.sh @@ -37,6 +37,7 @@ FEES_ENV_NAME="${FEES_ENV:-$(resolve_runtime_env_name)}" load_runtime_env_bundle "${FEES_ENV_NAME}" IMAGE_TAG="$(compute_image_tag)" +FEES_CONFIG_PATH="$(resolve_app_config_path "api/billing/fees/config.yml")" REGISTRY_URL="${REGISTRY_URL:?missing REGISTRY_URL}" APP_V="${APP_V:?missing APP_V}" @@ -69,6 +70,7 @@ fi --context "${BUILD_CONTEXT}" \ --dockerfile "${FEES_DOCKERFILE}" \ --destination "${REGISTRY_URL}/${FEES_IMAGE_PATH}:${IMAGE_TAG}" \ + --build-arg APP_CONFIG_PATH="${FEES_CONFIG_PATH}" \ --build-arg APP_VERSION="${APP_V}" \ --build-arg GIT_REV="${GIT_REV}" \ --build-arg BUILD_BRANCH="${BUILD_BRANCH}" \ diff --git a/ci/scripts/callbacks/build-image.sh b/ci/scripts/callbacks/build-image.sh index 9c6cf7d1..4f42c387 100755 --- a/ci/scripts/callbacks/build-image.sh +++ b/ci/scripts/callbacks/build-image.sh @@ -37,10 +37,7 @@ CALLBACKS_ENV_NAME="${CALLBACKS_ENV:-$(resolve_runtime_env_name)}" load_runtime_env_bundle "${CALLBACKS_ENV_NAME}" IMAGE_TAG="$(compute_image_tag)" -CALLBACKS_CONFIG_PATH="api/edge/callbacks/config.yml" -if [ "${CI_RUNTIME_ENV_NAME:-prod}" = "devserver" ] && [ -f "${REPO_ROOT}/api/edge/callbacks/config.dev.yml" ]; then - CALLBACKS_CONFIG_PATH="api/edge/callbacks/config.dev.yml" -fi +CALLBACKS_CONFIG_PATH="$(resolve_app_config_path "api/edge/callbacks/config.yml")" REGISTRY_URL="${REGISTRY_URL:?missing REGISTRY_URL}" APP_V="${APP_V:?missing APP_V}" diff --git a/ci/scripts/chain_gateway/build-image.sh b/ci/scripts/chain_gateway/build-image.sh index 8382a4bd..2b8fc1c2 100755 --- a/ci/scripts/chain_gateway/build-image.sh +++ b/ci/scripts/chain_gateway/build-image.sh @@ -37,10 +37,7 @@ CHAIN_GATEWAY_ENV_NAME="${CHAIN_GATEWAY_ENV:-$(resolve_runtime_env_name)}" load_runtime_env_bundle "${CHAIN_GATEWAY_ENV_NAME}" IMAGE_TAG="$(compute_image_tag)" -CHAIN_GATEWAY_CONFIG_PATH="api/gateway/chain/config.yml" -if [ "${CI_RUNTIME_ENV_NAME:-prod}" = "devserver" ] && [ -f "${REPO_ROOT}/api/gateway/chain/config.dev.yml" ]; then - CHAIN_GATEWAY_CONFIG_PATH="api/gateway/chain/config.dev.yml" -fi +CHAIN_GATEWAY_CONFIG_PATH="$(resolve_app_config_path "api/gateway/chain/config.yml")" REGISTRY_URL="${REGISTRY_URL:?missing REGISTRY_URL}" APP_V="${APP_V:?missing APP_V}" diff --git a/ci/scripts/check-config-coherence.sh b/ci/scripts/check-config-coherence.sh new file mode 100755 index 00000000..66aa7c20 --- /dev/null +++ b/ci/scripts/check-config-coherence.sh @@ -0,0 +1,88 @@ +#!/bin/sh +set -eu + +REPO_ROOT="$(cd "$(dirname "$0")/../.." && pwd)" +cd "${REPO_ROOT}" + +fail() { + echo "[config-coherence] $*" >&2 + exit 1 +} + +check_absent() { + pattern="$1" + shift + if rg -n "${pattern}" "$@" >/tmp/sendico-config-check.out 2>/dev/null; then + cat /tmp/sendico-config-check.out >&2 + fail "unexpected match for pattern: ${pattern}" + fi +} + +check_present() { + pattern="$1" + file="$2" + if ! rg -n "${pattern}" "${file}" >/tmp/sendico-config-check.out 2>/dev/null; then + fail "missing required pattern '${pattern}' in ${file}" + fi +} + +check_absent 'config\.dev\.yml:/app/config\.yml' docker-compose.dev.yml +check_absent 'advertise_host: "dev-|address: dev-[^"]*:[0-9]+' api/**/config.dev.yml +check_absent 'advertise_host: "sendico_|address: sendico_[^"]*:[0-9]+' api/**/config.local.yml + +while IFS= read -r script; do + [ -n "${script}" ] || continue + check_present 'resolve_app_config_path' "${script}" + sh -n "${script}" +done <<'EOF' +ci/scripts/aurora/build-image.sh +ci/scripts/bff/build-image.sh +ci/scripts/billing_documents/build-image.sh +ci/scripts/billing_fees/build-image.sh +ci/scripts/callbacks/build-image.sh +ci/scripts/chain_gateway/build-image.sh +ci/scripts/chsettle/build-image.sh +ci/scripts/discovery/build-image.sh +ci/scripts/fx/build-image.sh +ci/scripts/ledger/build-image.sh +ci/scripts/mntx/build-image.sh +ci/scripts/notification/build-image.sh +ci/scripts/payments_methods/build-image.sh +ci/scripts/payments_orchestrator/build-image.sh +ci/scripts/payments_quotation/build-image.sh +ci/scripts/tgsettle/build-image.sh +ci/scripts/tron_gateway/build-image.sh +EOF + +sh -n ci/scripts/common/runtime_env.sh + +while IFS= read -r dockerfile; do + [ -n "${dockerfile}" ] || continue + check_present 'ARG APP_CONFIG_PATH=' "${dockerfile}" + check_present 'COPY \$\{APP_CONFIG_PATH\} /app/config.yml' "${dockerfile}" +done <<'EOF' +ci/prod/compose/aurora_gateway.dockerfile +ci/prod/compose/bff.dockerfile +ci/prod/compose/billing_documents.dockerfile +ci/prod/compose/billing_fees.dockerfile +ci/prod/compose/callbacks.dockerfile +ci/prod/compose/chain_gateway.dockerfile +ci/prod/compose/chsettle_gateway.dockerfile +ci/prod/compose/discovery.dockerfile +ci/prod/compose/fx_ingestor.dockerfile +ci/prod/compose/fx_oracle.dockerfile +ci/prod/compose/ledger.dockerfile +ci/prod/compose/mntx_gateway.dockerfile +ci/prod/compose/notification.dockerfile +ci/prod/compose/payments_methods.dockerfile +ci/prod/compose/payments_orchestrator.dockerfile +ci/prod/compose/payments_quotation.dockerfile +ci/prod/compose/tgsettle_gateway.dockerfile +ci/prod/compose/tron_gateway.dockerfile +EOF + +if command -v docker >/dev/null 2>&1 && [ -f .env.dev ]; then + docker compose -f docker-compose.dev.yml --env-file .env.dev config >/tmp/sendico-config-check-compose.out +fi + +echo "[config-coherence] OK" diff --git a/ci/scripts/chsettle/build-image.sh b/ci/scripts/chsettle/build-image.sh index 4b71c291..e7f7ff33 100644 --- a/ci/scripts/chsettle/build-image.sh +++ b/ci/scripts/chsettle/build-image.sh @@ -37,6 +37,7 @@ CHSETTLE_GATEWAY_ENV_NAME="${CHSETTLE_GATEWAY_ENV:-$(resolve_runtime_env_name)}" load_runtime_env_bundle "${CHSETTLE_GATEWAY_ENV_NAME}" IMAGE_TAG="$(compute_image_tag)" +CHSETTLE_GATEWAY_CONFIG_PATH="$(resolve_app_config_path "api/gateway/chsettle/config.yml")" REGISTRY_URL="${REGISTRY_URL:?missing REGISTRY_URL}" APP_V="${APP_V:?missing APP_V}" @@ -86,6 +87,7 @@ fi --context "${BUILD_CONTEXT}" \ --dockerfile "${CHSETTLE_GATEWAY_DOCKERFILE}" \ --destination "${REGISTRY_URL}/${CHSETTLE_GATEWAY_IMAGE_PATH}:${IMAGE_TAG}" \ + --build-arg APP_CONFIG_PATH="${CHSETTLE_GATEWAY_CONFIG_PATH}" \ --build-arg APP_VERSION="${APP_V}" \ --build-arg GIT_REV="${GIT_REV}" \ --build-arg BUILD_BRANCH="${BUILD_BRANCH}" \ diff --git a/ci/scripts/common/runtime_env.sh b/ci/scripts/common/runtime_env.sh index c9176ffb..7bdc59a4 100644 --- a/ci/scripts/common/runtime_env.sh +++ b/ci/scripts/common/runtime_env.sh @@ -111,3 +111,15 @@ compute_image_tag() { : "${GIT_REV:?missing GIT_REV}" printf '%s-%s\n' "${APP_V}" "${GIT_REV}" } + +resolve_app_config_path() { + config_path="$1" + dev_config_path="${config_path%.yml}.dev.yml" + + if [ "${CI_RUNTIME_ENV_NAME:-prod}" = "devserver" ] && [ -f "${dev_config_path}" ]; then + printf '%s\n' "${dev_config_path}" + return + fi + + printf '%s\n' "${config_path}" +} diff --git a/ci/scripts/discovery/build-image.sh b/ci/scripts/discovery/build-image.sh index 5995231f..8e6a2e68 100644 --- a/ci/scripts/discovery/build-image.sh +++ b/ci/scripts/discovery/build-image.sh @@ -37,6 +37,7 @@ DISCOVERY_ENV_NAME="${DISCOVERY_ENV:-$(resolve_runtime_env_name)}" load_runtime_env_bundle "${DISCOVERY_ENV_NAME}" IMAGE_TAG="$(compute_image_tag)" +DISCOVERY_CONFIG_PATH="$(resolve_app_config_path "api/discovery/config.yml")" REGISTRY_URL="${REGISTRY_URL:?missing REGISTRY_URL}" APP_V="${APP_V:?missing APP_V}" @@ -69,6 +70,7 @@ fi --context "${BUILD_CONTEXT}" \ --dockerfile "${DISCOVERY_DOCKERFILE}" \ --destination "${REGISTRY_URL}/${DISCOVERY_IMAGE_PATH}:${IMAGE_TAG}" \ + --build-arg APP_CONFIG_PATH="${DISCOVERY_CONFIG_PATH}" \ --build-arg APP_VERSION="${APP_V}" \ --build-arg GIT_REV="${GIT_REV}" \ --build-arg BUILD_BRANCH="${BUILD_BRANCH}" \ diff --git a/ci/scripts/fx/build-image.sh b/ci/scripts/fx/build-image.sh index b9cd092b..658746be 100755 --- a/ci/scripts/fx/build-image.sh +++ b/ci/scripts/fx/build-image.sh @@ -37,6 +37,18 @@ FX_ENV_NAME="${FX_ENV:-$(resolve_runtime_env_name)}" load_runtime_env_bundle "${FX_ENV_NAME}" IMAGE_TAG="$(compute_image_tag)" +case "$(basename "${FX_DOCKERFILE}")" in + fx_oracle.dockerfile) + FX_CONFIG_PATH="$(resolve_app_config_path "api/fx/oracle/config.yml")" + ;; + fx_ingestor.dockerfile) + FX_CONFIG_PATH="$(resolve_app_config_path "api/fx/ingestor/config.yml")" + ;; + *) + echo "[fx-build] unsupported dockerfile for config selection: ${FX_DOCKERFILE}" >&2 + exit 69 + ;; +esac REGISTRY_URL="${REGISTRY_URL:?missing REGISTRY_URL}" APP_V="${APP_V:?missing APP_V}" @@ -69,6 +81,7 @@ fi --context "${BUILD_CONTEXT}" \ --dockerfile "${FX_DOCKERFILE}" \ --destination "${REGISTRY_URL}/${FX_IMAGE_PATH}:${IMAGE_TAG}" \ + --build-arg APP_CONFIG_PATH="${FX_CONFIG_PATH}" \ --build-arg APP_VERSION="${APP_V}" \ --build-arg GIT_REV="${GIT_REV}" \ --build-arg BUILD_BRANCH="${BUILD_BRANCH}" \ diff --git a/ci/scripts/ledger/build-image.sh b/ci/scripts/ledger/build-image.sh index 511234f3..4f136127 100755 --- a/ci/scripts/ledger/build-image.sh +++ b/ci/scripts/ledger/build-image.sh @@ -37,6 +37,7 @@ LEDGER_ENV_NAME="${LEDGER_ENV:-$(resolve_runtime_env_name)}" load_runtime_env_bundle "${LEDGER_ENV_NAME}" IMAGE_TAG="$(compute_image_tag)" +LEDGER_CONFIG_PATH="$(resolve_app_config_path "api/ledger/config.yml")" REGISTRY_URL="${REGISTRY_URL:?missing REGISTRY_URL}" APP_V="${APP_V:?missing APP_V}" @@ -69,6 +70,7 @@ fi --context "${BUILD_CONTEXT}" \ --dockerfile "${LEDGER_DOCKERFILE}" \ --destination "${REGISTRY_URL}/${LEDGER_IMAGE_PATH}:${IMAGE_TAG}" \ + --build-arg APP_CONFIG_PATH="${LEDGER_CONFIG_PATH}" \ --build-arg APP_VERSION="${APP_V}" \ --build-arg GIT_REV="${GIT_REV}" \ --build-arg BUILD_BRANCH="${BUILD_BRANCH}" \ diff --git a/ci/scripts/mntx/build-image.sh b/ci/scripts/mntx/build-image.sh index 7921781b..a0e39124 100644 --- a/ci/scripts/mntx/build-image.sh +++ b/ci/scripts/mntx/build-image.sh @@ -37,6 +37,7 @@ MNTX_GATEWAY_ENV_NAME="${MNTX_GATEWAY_ENV:-$(resolve_runtime_env_name)}" load_runtime_env_bundle "${MNTX_GATEWAY_ENV_NAME}" IMAGE_TAG="$(compute_image_tag)" +MNTX_GATEWAY_CONFIG_PATH="$(resolve_app_config_path "api/gateway/mntx/config.yml")" REGISTRY_URL="${REGISTRY_URL:?missing REGISTRY_URL}" APP_V="${APP_V:?missing APP_V}" @@ -86,6 +87,7 @@ fi --context "${BUILD_CONTEXT}" \ --dockerfile "${MNTX_GATEWAY_DOCKERFILE}" \ --destination "${REGISTRY_URL}/${MNTX_GATEWAY_IMAGE_PATH}:${IMAGE_TAG}" \ + --build-arg APP_CONFIG_PATH="${MNTX_GATEWAY_CONFIG_PATH}" \ --build-arg APP_VERSION="${APP_V}" \ --build-arg GIT_REV="${GIT_REV}" \ --build-arg BUILD_BRANCH="${BUILD_BRANCH}" \ diff --git a/ci/scripts/notification/build-image.sh b/ci/scripts/notification/build-image.sh index b64b03a4..1529dd43 100755 --- a/ci/scripts/notification/build-image.sh +++ b/ci/scripts/notification/build-image.sh @@ -37,6 +37,7 @@ NOTIFICATION_ENV_NAME="${NOTIFICATION_ENV:-$(resolve_runtime_env_name)}" load_runtime_env_bundle "${NOTIFICATION_ENV_NAME}" IMAGE_TAG="$(compute_image_tag)" +NOTIFICATION_CONFIG_PATH="$(resolve_app_config_path "api/notification/config.yml")" REGISTRY_URL="${REGISTRY_URL:?missing REGISTRY_URL}" APP_V="${APP_V:?missing APP_V}" @@ -69,6 +70,7 @@ fi --context "${BUILD_CONTEXT}" \ --dockerfile "${NOTIFICATION_DOCKERFILE}" \ --destination "${REGISTRY_URL}/${NOTIFICATION_IMAGE_PATH}:${IMAGE_TAG}" \ + --build-arg APP_CONFIG_PATH="${NOTIFICATION_CONFIG_PATH}" \ --build-arg APP_VERSION="${APP_V}" \ --build-arg GIT_REV="${GIT_REV}" \ --build-arg BUILD_BRANCH="${BUILD_BRANCH}" \ diff --git a/ci/scripts/payments_methods/build-image.sh b/ci/scripts/payments_methods/build-image.sh index 24dedc17..3dd671ed 100755 --- a/ci/scripts/payments_methods/build-image.sh +++ b/ci/scripts/payments_methods/build-image.sh @@ -37,6 +37,7 @@ PAYMENTS_METHODS_ENV_NAME="${PAYMENTS_METHODS_ENV:-$(resolve_runtime_env_name)}" load_runtime_env_bundle "${PAYMENTS_METHODS_ENV_NAME}" IMAGE_TAG="$(compute_image_tag)" +PAYMENTS_METHODS_CONFIG_PATH="$(resolve_app_config_path "api/payments/methods/config.yml")" REGISTRY_URL="${REGISTRY_URL:?missing REGISTRY_URL}" APP_V="${APP_V:?missing APP_V}" @@ -69,6 +70,7 @@ fi --context "${BUILD_CONTEXT}" \ --dockerfile "${PAYMENTS_METHODS_DOCKERFILE}" \ --destination "${REGISTRY_URL}/${PAYMENTS_METHODS_IMAGE_PATH}:${IMAGE_TAG}" \ + --build-arg APP_CONFIG_PATH="${PAYMENTS_METHODS_CONFIG_PATH}" \ --build-arg APP_VERSION="${APP_V}" \ --build-arg GIT_REV="${GIT_REV}" \ --build-arg BUILD_BRANCH="${BUILD_BRANCH}" \ diff --git a/ci/scripts/payments_orchestrator/build-image.sh b/ci/scripts/payments_orchestrator/build-image.sh index 3a2edd4d..6fd72fd5 100755 --- a/ci/scripts/payments_orchestrator/build-image.sh +++ b/ci/scripts/payments_orchestrator/build-image.sh @@ -37,6 +37,7 @@ PAYMENTS_ENV_NAME="${PAYMENTS_ENV:-$(resolve_runtime_env_name)}" load_runtime_env_bundle "${PAYMENTS_ENV_NAME}" IMAGE_TAG="$(compute_image_tag)" +PAYMENTS_CONFIG_PATH="$(resolve_app_config_path "api/payments/orchestrator/config.yml")" REGISTRY_URL="${REGISTRY_URL:?missing REGISTRY_URL}" APP_V="${APP_V:?missing APP_V}" @@ -69,6 +70,7 @@ fi --context "${BUILD_CONTEXT}" \ --dockerfile "${PAYMENTS_DOCKERFILE}" \ --destination "${REGISTRY_URL}/${PAYMENTS_IMAGE_PATH}:${IMAGE_TAG}" \ + --build-arg APP_CONFIG_PATH="${PAYMENTS_CONFIG_PATH}" \ --build-arg APP_VERSION="${APP_V}" \ --build-arg GIT_REV="${GIT_REV}" \ --build-arg BUILD_BRANCH="${BUILD_BRANCH}" \ diff --git a/ci/scripts/payments_quotation/build-image.sh b/ci/scripts/payments_quotation/build-image.sh index 8ff7229b..138b0794 100755 --- a/ci/scripts/payments_quotation/build-image.sh +++ b/ci/scripts/payments_quotation/build-image.sh @@ -37,6 +37,7 @@ PAYMENTS_QUOTATION_ENV_NAME="${PAYMENTS_QUOTATION_ENV:-$(resolve_runtime_env_nam load_runtime_env_bundle "${PAYMENTS_QUOTATION_ENV_NAME}" IMAGE_TAG="$(compute_image_tag)" +PAYMENTS_QUOTATION_CONFIG_PATH="$(resolve_app_config_path "api/payments/quotation/config.yml")" REGISTRY_URL="${REGISTRY_URL:?missing REGISTRY_URL}" APP_V="${APP_V:?missing APP_V}" @@ -69,6 +70,7 @@ fi --context "${BUILD_CONTEXT}" \ --dockerfile "${PAYMENTS_QUOTATION_DOCKERFILE}" \ --destination "${REGISTRY_URL}/${PAYMENTS_QUOTATION_IMAGE_PATH}:${IMAGE_TAG}" \ + --build-arg APP_CONFIG_PATH="${PAYMENTS_QUOTATION_CONFIG_PATH}" \ --build-arg APP_VERSION="${APP_V}" \ --build-arg GIT_REV="${GIT_REV}" \ --build-arg BUILD_BRANCH="${BUILD_BRANCH}" \ diff --git a/ci/scripts/tgsettle/build-image.sh b/ci/scripts/tgsettle/build-image.sh index 5fff897b..74046ed9 100755 --- a/ci/scripts/tgsettle/build-image.sh +++ b/ci/scripts/tgsettle/build-image.sh @@ -37,6 +37,7 @@ TGSETTLE_GATEWAY_ENV_NAME="${TGSETTLE_GATEWAY_ENV:-$(resolve_runtime_env_name)}" load_runtime_env_bundle "${TGSETTLE_GATEWAY_ENV_NAME}" IMAGE_TAG="$(compute_image_tag)" +TGSETTLE_GATEWAY_CONFIG_PATH="$(resolve_app_config_path "api/gateway/tgsettle/config.yml")" REGISTRY_URL="${REGISTRY_URL:?missing REGISTRY_URL}" APP_V="${APP_V:?missing APP_V}" @@ -86,6 +87,7 @@ fi --context "${BUILD_CONTEXT}" \ --dockerfile "${TGSETTLE_GATEWAY_DOCKERFILE}" \ --destination "${REGISTRY_URL}/${TGSETTLE_GATEWAY_IMAGE_PATH}:${IMAGE_TAG}" \ + --build-arg APP_CONFIG_PATH="${TGSETTLE_GATEWAY_CONFIG_PATH}" \ --build-arg APP_VERSION="${APP_V}" \ --build-arg GIT_REV="${GIT_REV}" \ --build-arg BUILD_BRANCH="${BUILD_BRANCH}" \ diff --git a/ci/scripts/tron_gateway/build-image.sh b/ci/scripts/tron_gateway/build-image.sh index ff93fbb9..d9d69306 100755 --- a/ci/scripts/tron_gateway/build-image.sh +++ b/ci/scripts/tron_gateway/build-image.sh @@ -37,10 +37,7 @@ TRON_GATEWAY_ENV_NAME="${TRON_GATEWAY_ENV:-$(resolve_runtime_env_name)}" load_runtime_env_bundle "${TRON_GATEWAY_ENV_NAME}" IMAGE_TAG="$(compute_image_tag)" -TRON_GATEWAY_CONFIG_PATH="api/gateway/tron/config.yml" -if [ "${CI_RUNTIME_ENV_NAME:-prod}" = "devserver" ] && [ -f "${REPO_ROOT}/api/gateway/tron/config.dev.yml" ]; then - TRON_GATEWAY_CONFIG_PATH="api/gateway/tron/config.dev.yml" -fi +TRON_GATEWAY_CONFIG_PATH="$(resolve_app_config_path "api/gateway/tron/config.yml")" REGISTRY_URL="${REGISTRY_URL:?missing REGISTRY_URL}" APP_V="${APP_V:?missing APP_V}" diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 78ab62cf..d35ea7cf 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -236,7 +236,7 @@ services: dev-nats: { condition: service_started } volumes: - ./api/discovery:/src/api/discovery - - ./api/discovery/config.dev.yml:/app/config.yml:ro + - ./api/discovery/config.local.yml:/app/config.yml:ro ports: - "9407:9407" networks: @@ -271,7 +271,7 @@ services: dev-nats: { condition: service_started } volumes: - ./api/fx/oracle:/src/api/fx/oracle - - ./api/fx/oracle/config.dev.yml:/app/config.yml:ro + - ./api/fx/oracle/config.local.yml:/app/config.yml:ro ports: - "50051:50051" - "9400:9400" @@ -316,7 +316,7 @@ services: dev-fx-oracle: { condition: service_healthy } volumes: - ./api/billing/fees:/src/api/billing/fees - - ./api/billing/fees/config.dev.yml:/app/config.yml:ro + - ./api/billing/fees/config.local.yml:/app/config.yml:ro ports: - "50060:50060" - "9402:9402" @@ -359,7 +359,7 @@ services: dev-nats: { condition: service_started } volumes: - ./api/billing/documents:/src/api/billing/documents - - ./api/billing/documents/config.dev.yml:/app/config.yml:ro + - ./api/billing/documents/config.local.yml:/app/config.yml:ro ports: - "50061:50061" - "9409:9409" @@ -405,7 +405,7 @@ services: dev-billing-fees: { condition: service_healthy } volumes: - ./api/ledger:/src/api/ledger - - ./api/ledger/config.dev.yml:/app/config.yml:ro + - ./api/ledger/config.local.yml:/app/config.yml:ro ports: - "50052:50052" - "9401:9401" @@ -455,7 +455,7 @@ services: dev-nats: { condition: service_started } volumes: - ./api/fx/ingestor:/src/api/fx/ingestor - - ./api/fx/ingestor/config.dev.yml:/app/config.yml:ro + - ./api/fx/ingestor/config.local.yml:/app/config.yml:ro ports: - "9102:9102" networks: @@ -500,7 +500,7 @@ services: volumes: - ./api/payments/orchestrator:/src/api/payments/orchestrator - ./api/payments/storage:/src/api/payments/storage - - ./api/payments/orchestrator/config.dev.yml:/app/config.yml:ro + - ./api/payments/orchestrator/config.local.yml:/app/config.yml:ro ports: - "50062:50062" - "9403:9403" @@ -549,7 +549,7 @@ services: volumes: - ./api/payments/quotation:/src/api/payments/quotation - ./api/payments/storage:/src/api/payments/storage - - ./api/payments/quotation/config.dev.yml:/app/config.yml:ro + - ./api/payments/quotation/config.local.yml:/app/config.yml:ro ports: - "50064:50064" - "9414:9414" @@ -596,7 +596,7 @@ services: volumes: - ./api/payments/methods:/src/api/payments/methods - ./api/payments/storage:/src/api/payments/storage - - ./api/payments/methods/config.dev.yml:/app/config.yml:ro + - ./api/payments/methods/config.local.yml:/app/config.yml:ro ports: - "50066:50066" - "9416:9416" @@ -683,7 +683,7 @@ services: volumes: - ./api/gateway/chain:/src/api/gateway/chain - ./api/gateway/common:/src/api/gateway/common - - ./api/gateway/chain/config.dev.yml:/app/config.yml:ro + - ./api/gateway/chain/config.local.yml:/app/config.yml:ro - dev-chain-gateway-vault-run:/run/vault:ro ports: - "50070:50070" @@ -767,7 +767,7 @@ services: volumes: - ./api/gateway/tron:/src/api/gateway/tron - ./api/gateway/common:/src/api/gateway/common - - ./api/gateway/tron/config.dev.yml:/app/config.yml:ro + - ./api/gateway/tron/config.local.yml:/app/config.yml:ro - dev-tron-gateway-vault-run:/run/vault:ro ports: - "50071:50071" @@ -819,7 +819,7 @@ services: volumes: - ./api/gateway/aurora:/src/api/gateway/aurora - ./api/gateway/common:/src/api/gateway/common - - ./api/gateway/aurora/config.dev.yml:/app/config.yml:ro + - ./api/gateway/aurora/config.local.yml:/app/config.yml:ro ports: - "50075:50075" - "9405:9405" @@ -869,7 +869,7 @@ services: volumes: - ./api/gateway/chsettle:/src/api/gateway/chsettle - ./api/gateway/common:/src/api/gateway/common - - ./api/gateway/chsettle/config.dev.yml:/app/config.yml:ro + - ./api/gateway/chsettle/config.local.yml:/app/config.yml:ro ports: - "50080:50080" - "9406:9406" @@ -913,7 +913,7 @@ services: dev-nats: { condition: service_started } volumes: - ./api/notification:/src/api/notification - - ./api/notification/config.dev.yml:/app/config.yml:ro + - ./api/notification/config.local.yml:/app/config.yml:ro ports: - "8081:8081" networks: @@ -990,7 +990,7 @@ services: dev-callbacks-vault-agent: { condition: service_healthy } volumes: - ./api/edge/callbacks:/src/api/edge/callbacks - - ./api/edge/callbacks/config.dev.yml:/app/config.yml:ro + - ./api/edge/callbacks/config.local.yml:/app/config.yml:ro - dev-callbacks-vault-run:/run/vault:ro ports: - "9420:9420" @@ -1074,7 +1074,7 @@ services: dev-bff-vault-agent: { condition: service_healthy } volumes: - ./api/edge/bff:/src/api/edge/bff - - ./api/edge/bff/config.dev.yml:/app/config.yml:ro + - ./api/edge/bff/config.local.yml:/app/config.yml:ro - dev-bff-vault-run:/run/vault:ro ports: - "8080:8080"