Skip to content

Commit

Permalink
feat: add chainID and network to labels
Browse files Browse the repository at this point in the history
  • Loading branch information
endersonmaia committed Sep 28, 2023
1 parent 82206f8 commit a8804f8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
2 changes: 1 addition & 1 deletion charts/rollups-node/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ maintainers:
url: https://github.com/oap75

type: application
version: 1.0.2-1
version: 1.0.2-2

dependencies:
- name: redis
Expand Down
21 changes: 16 additions & 5 deletions charts/rollups-node/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ TODO: diff between query and validator
{{- if not .Values.localnode.enabled -}}
dapp.cartesi.io/contract-address: {{ required "A valid .Values.dapp.contractAddress is required" .Values.dapp.contractAddress | lower | quote }}
{{end -}}
dapp.cartesi.io/chain-id: {{ include "dapp.chainID" . | quote }}
dapp.cartesi.io/network: {{ include "dapp.network" . | quote }}
app.kubernetes.io/name: {{ include "validator.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
Expand Down Expand Up @@ -176,14 +178,23 @@ Usage:
{{- end -}}

{{/*
Return the chainID based on the network
Return the network name
*/}}
{{- define "dapp.chainID" -}}
{{- $networkIDs := dict "mainnet" "1" "optimism" "10" "optimism-goerli" "420" "arbitrum" "42161" "arbitrum-goerli" "421613" "localhost" "31337" "sepolia" "11155111" -}}
{{- $network := .Values.dapp.network }}
{{- define "dapp.network" -}}
{{- $network := "" }}
{{- if .Values.localnode.enabled }}
{{- $network = "localhost" }}
{{- else }}
{{- $network = .Values.dapp.network }}
{{- end }}
{{- $chainID := index $networkIDs $network }}
{{- $network }}
{{- end -}}

{{/*
Return the chainID based on the network
*/}}
{{- define "dapp.chainID" -}}
{{- $networkIDs := dict "mainnet" "1" "optimism" "10" "optimism-goerli" "420" "arbitrum" "42161" "arbitrum-goerli" "421613" "localhost" "31337" "sepolia" "11155111" -}}
{{- $chainID := index $networkIDs (include "dapp.network" .) }}
{{- $chainID }}
{{- end -}}

0 comments on commit a8804f8

Please sign in to comment.