Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ft/multiple entry/docker file2 #1436

Open
wants to merge 15 commits into
base: development
Choose a base branch
from
1 change: 1 addition & 0 deletions config/config.devnet-old.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
network: 'devnet-old'
dappNetwork: 'devnet-old'
metaChainShardId: 4294967295
api:
public: true
Expand Down
1 change: 1 addition & 0 deletions config/config.devnet.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
network: 'devnet'
dappNetwork: 'devnet'
metaChainShardId: 4294967295
api:
public: true
Expand Down
1 change: 1 addition & 0 deletions config/config.e2e-mocked.mainnet.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
network: 'mainnet'
dappNetwork: 'mainnet'
metaChainShardId: 4294967295
api:
public: true
Expand Down
1 change: 1 addition & 0 deletions config/config.e2e.mainnet.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
network: 'mainnet'
dappNetwork: 'mainnet'
metaChainShardId: 4294967295
api:
public: true
Expand Down
1 change: 1 addition & 0 deletions config/config.mainnet.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
network: 'mainnet'
dappNetwork: 'mainnet'
metaChainShardId: 4294967295
api:
public: true
Expand Down
33 changes: 17 additions & 16 deletions config/config.placeholder.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
network: 'DAPP_CONFIG'
network: 'testnet'
dappNetwork: 'DAPP_CONFIG'
metaChainShardId: 4294967295
api:
public: true
public: MVX_API_PUBLIC
publicPort: 3001
private: true
private: MVX_API_PRIVATE
privatePort: 4001
websocket: true
cron:
cacheWarmer: true
cacheWarmer: MVX_CACHEWARMER
fastWarm: true
queueWorker: true
elasticUpdater: false
Expand All @@ -21,9 +22,9 @@ flags:
collectionPropertiesFromGateway: false
features:
eventsNotifier:
enabled: false
enabled: MVX_EVENTS_NOTIFIER
port: 5674
url: 'amqp://guest:[email protected]:5673'
url: 'MVX_EVENTS_NOTIFIER_RABBIT_URL'
exchange: 'all_events'
queue: 'api-process-logs-and-events'
guestCaching:
Expand Down Expand Up @@ -61,16 +62,16 @@ features:
- ''
jwtSecret: ''
stakingV4:
enabled: false
enabled: MVX_STAKINGV4
cronExpression: '*/5 * * * * *'
activationEpoch: 1043
nodeEpochsLeft:
enabled: false
transactionProcessor:
enabled: false
enabled: MVX_TRANSACTIONPROCESSOR
maxLookBehind: 100
transactionCompleted:
enabled: false
enabled: MVX_transactionCompleted
maxLookBehind: 100
logLevel: 'Error'
transactionBatch:
Expand All @@ -97,14 +98,14 @@ features:
enabled: false
maxLookBehindNonces: 100
nodesFetch:
enabled: true
serviceUrl: 'NODESFETCH_URL'
enabled: MVX_NODESFETCH_ENABLE
serviceUrl: 'MVX_NODESFETCH_URL'
tokensFetch:
enabled: true
serviceUrl: 'TOKENSFETCH_URL'
enabled: MVX_TOKENSFETCH_ENABLE
serviceUrl: 'MVX_TOKENSFETCH_URL'
providersFetch:
enabled: true
serviceUrl: 'PROVIDERSFETCH_URL'
enabled: MVX_PROVIDERSFETCH_ENABLE
serviceUrl: 'MVX_PROVIDERSFETCH_URL'
image:
width: 600
height: 600
Expand Down Expand Up @@ -147,7 +148,7 @@ caching:
cacheTtl: 6
processTtl: 600
poolLimit: 50
cacheDuration: 3
cacheDuration: MVX_CACHING_cacheDuration
keepAliveTimeout:
downstream: 61000
upstream: 60000
Expand Down
1 change: 1 addition & 0 deletions config/config.testnet.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
network: 'testnet'
dappNetwork: 'testnet'
metaChainShardId: 4294967295
api:
public: true
Expand Down
68 changes: 39 additions & 29 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,30 +1,45 @@
#!/bin/sh
# ENV VARIABLES
# MVX_ENV=devnet
# DAPP_CONFIG=devnet
# REDIS_IP=127.0.0.1
# ELASTICSEARCH_URL=https://devnet-index.multiversx.com
# GATEWAY_URL=https://devnet-gateway.multiversx.com
# RABBITMQ_URL=amqp://127.0.0.1:5672
# PROVIDERS_URL=https://devnet-delegation-api.multiversx.com/providers
# DELEGATION_URL=https://devnet-delegation-api.multiversx.com
# SOCKET_URL=devnet-socket-api.multiversx.com
# NODESFETCH_URL= https://devnet-api.multiversx.com
# TOKENSFETCH_URL= https://devnet-api.multiversx.com
# PROVIDERSFETCH_URL= https://devnet-api.multiversx.com
# DATAAPI_URL=https://devnet-data-api.multiversx.com
# EXCHANGE_URL=https://devnet-graph.xexchange.com/graphql
# MARKETPLACE_URL=https://devnet-nfts-graph.multiversx.com/graphql
# ASSETSFETCH_URL=https://tools.multiversx.com/assets-cdn
# PLACEHOLDER_DAPP_id=devnet
# PLACEHOLDER_DAPP_name=Devnet
# PLACEHOLDER_DAPP_egldLabel=xEGLD
# PLACEHOLDER_DAPP_walletAddress=https://devnet-wallet.multiversx.com
# PLACEHOLDER_DAPP_apiAddress=https://devnet-api.multiversx.com
# PLACEHOLDER_DAPP_explorerAddress=http://devnet-explorer.multiversx.com
# PLACEHOLDER_DAPP_chainId=D
env_vars_with_defaults="MVX_ENV=devnet \
DAPP_CONFIG=devnet \
MVX_API_PUBLIC=true \
MVX_API_PRIVATE=true \
MVX_CACHEWARMER=true \
MVX_TRANSACTIONPROCESSOR=false \
MVX_transactionCompleted=false \
MVX_CACHING_cacheDuration=3 \
MVX_STAKINGV4=false \
MVX_EVENTS_NOTIFIER=false \
MVX_EVENTS_NOTIFIER_RABBIT_URL=amqp://guest:[email protected]:5673 \
REDIS_IP=127.0.0.1 \
ELASTICSEARCH_URL=https://devnet-index.multiversx.com \
GATEWAY_URL=https://devnet-gateway.multiversx.com \
RABBITMQ_URL=amqp://127.0.0.1:5672 \
PROVIDERS_URL=https://devnet-delegation-api.multiversx.com/providers \
DATAAPI_URL=https://devnet-data-api.multiversx.com \
EXCHANGE_URL=https://devnet-graph.xexchange.com/graphql \
MARKETPLACE_URL=https://devnet-nfts-graph.multiversx.com/graphql \
ASSETSFETCH_URL=https://tools.multiversx.com/assets-cdn \
DELEGATION_URL=https://devnet-delegation-api.multiversx.com \
SOCKET_URL=devnet-socket-api.multiversx.com \
MVX_NODESFETCH_ENABLE=true \
MVX_NODESFETCH_URL=https://devnet-api.multiversx.com \
MVX_TOKENSFETCH_ENABLE=true \
MVX_TOKENSFETCH_URL=https://devnet-api.multiversx.com \
MVX_PROVIDERSFETCH_ENABLE=true \
MVX_PROVIDERSFETCH_URL=https://devnet-api.multiversx.com \
PLACEHOLDER_DAPP_id=devnet \
PLACEHOLDER_DAPP_name=Devnet \
PLACEHOLDER_DAPP_egldLabel=xEGLD \
PLACEHOLDER_DAPP_walletAddress=https://devnet-wallet.multiversx.com \
PLACEHOLDER_DAPP_apiAddress=https://devnet-api.multiversx.com \
PLACEHOLDER_DAPP_explorerAddress=http://devnet-explorer.multiversx.com \
PLACEHOLDER_DAPP_chainId=D"

env_vars_with_defaults="MVX_ENV=devnet DAPP_CONFIG=devnet REDIS_IP=127.0.0.1 ELASTICSEARCH_URL=https://devnet-index.multiversx.com GATEWAY_URL=https://devnet-gateway.multiversx.com RABBITMQ_URL=amqp://127.0.0.1:5672 PROVIDERS_URL=https://devnet-delegation-api.multiversx.com/providers DATAAPI_URL=https://devnet-data-api.multiversx.com EXCHANGE_URL=https://devnet-graph.xexchange.com/graphql MARKETPLACE_URL=https://devnet-nfts-graph.multiversx.com/graphql ASSETSFETCH_URL=https://tools.multiversx.com/assets-cdn DELEGATION_URL=https://devnet-delegation-api.multiversx.com SOCKET_URL=devnet-socket-api.multiversx.com NODESFETCH_URL=https://devnet-api.multiversx.com TOKENSFETCH_URL=https://devnet-api.multiversx.com PROVIDERSFETCH_URL=https://devnet-api.multiversx.com PLACEHOLDER_DAPP_id=devnet PLACEHOLDER_DAPP_name=Devnet PLACEHOLDER_DAPP_egldLabel=xEGLD PLACEHOLDER_DAPP_walletAddress=https://devnet-wallet.multiversx.com PLACEHOLDER_DAPP_apiAddress=https://devnet-api.multiversx.com PLACEHOLDER_DAPP_explorerAddress=http://devnet-explorer.multiversx.com PLACEHOLDER_DAPP_chainId=D"
cp ./config/config.placeholder.yaml /app/dist/config/config.yaml
if [ $? -eq 0 ]; then
echo "Config file copied successfully from config/config.placeholder.yaml /app/dist/config/config.yaml"
fi

replace_placeholder() {
local var_name=$1
Expand Down Expand Up @@ -52,11 +67,6 @@ for entry in $env_vars_with_defaults; do
# Use the environment variable value if defined; otherwise, use the default
eval "value=\${$var_name:-$default_value}"

cp ./config/config.placeholder.yaml /app/dist/config/config.yaml
if [ $? -eq 0 ]; then
echo "Config file copied successfully from config/config.placeholder.yaml /app/dist/config/config.yaml"
fi

# Execute the function with the variable name and value
replace_placeholder "$var_name" "$value"

Expand Down
9 changes: 9 additions & 0 deletions src/common/api-config/api.config.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,15 @@ export class ApiConfigService {
return network;
}

getDappNetwork(): string {
const network = this.configService.get<string>('dappNetwork');
if (!network) {
return this.getNetwork();
}

return network;
}

getCluster(): string | undefined {
return this.configService.get<string>('cluster');
}
Expand Down
2 changes: 1 addition & 1 deletion src/endpoints/dapp-config/dapp.config.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class DappConfigService {
}

getDappConfigurationRaw(): DappConfig | undefined {
const network = this.apiConfigService.getNetwork();
const network = this.apiConfigService.getDappNetwork();
const configuration = FileUtils.parseJSONFile(`./config/dapp.config.${network}.json`);

return configuration;
Expand Down
Loading