Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ const mode = process.env.NODE_ENV || "production";
const dotenvPath = path.resolve(__dirname, `.env.${mode}`);
dotenv.config({ path: dotenvPath });

const endpoints: string[] = process.env.ENDPOINT?.split(",") as string[];
console.log(`Endpoints: ${endpoints}`);

// Can expand the Datasource processor types via the generic param
const project: CosmosProject = {
specVersion: "1.0.0",
Expand All @@ -36,7 +39,7 @@ const project: CosmosProject = {
network: {
/* The unique chainID of the Cosmos Zone */
chainId: process.env.CHAIN_ID!,
endpoint: process.env.ENDPOINT!?.split(",") as string[] | string,
endpoint: endpoints,
chaintypes: new Map([
[
"cosmos.slashing.v1beta1",
Expand Down
14 changes: 13 additions & 1 deletion scripts/shared.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,20 @@ update_project() {
fi

if [ ! -z "${ENDPOINT}" ]; then
info_log "[Config Update] Network Endpoint: ${ENDPOINT}"
info_log "[Config Update] Network Endpoint: $ENDPOINT"
if echo "$ENDPOINT" | grep -q ','; then
yq -i '.network.endpoint = []' project.yaml
OLDIFS=$IFS
IFS=,
for ep in $ENDPOINT; do
# Remove leading/trailing whitespace
ep=$(printf "%s" "$ep" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
yq -i ".network.endpoint += [\"$ep\"]" project.yaml
done
IFS=$OLDIFS
else
yq -i '.network.endpoint = strenv(ENDPOINT)' project.yaml
fi
fi
}

Expand Down