From 2abe22b900f752440fa95834edf5031bf9a08128 Mon Sep 17 00:00:00 2001 From: Aryeh Harris Date: Fri, 29 Sep 2023 12:27:11 -0400 Subject: [PATCH] Update tezos-faucet chart for latest faucet code --- charts/tezos-faucet/templates/configmap.yaml | 16 ++++--- charts/tezos-faucet/templates/deployment.yaml | 11 ----- charts/tezos-faucet/values.yaml | 44 ++++++++----------- 3 files changed, 27 insertions(+), 44 deletions(-) diff --git a/charts/tezos-faucet/templates/configmap.yaml b/charts/tezos-faucet/templates/configmap.yaml index 743276714..c6e03c472 100644 --- a/charts/tezos-faucet/templates/configmap.yaml +++ b/charts/tezos-faucet/templates/configmap.yaml @@ -6,12 +6,9 @@ metadata: namespace: {{ .Release.Namespace }} data: config.json: | -{{- $newProfiles := dict }} -{{- range $key, $value := .Values.profiles }} - {{- $newProfiles = set $newProfiles $key (pick $value "amount" "profile") }} -{{- end }} -{{- $_ := set .Values.config.application "profiles" $newProfiles }} {{- $_ := set .Values.config.application "disableChallenges" .Values.disableChallenges }} +{{- $_ := set .Values.config.application "minTez" .Values.minTez }} +{{- $_ := set .Values.config.application "maxTez" .Values.maxTez }} {{ .Values.config | mustToPrettyJson | indent 4 }} --- {{- end }} @@ -22,11 +19,16 @@ metadata: name: faucet-backend-config namespace: {{ .Release.Namespace }} data: - profiles.json: {{ .Values.profiles | mustToPrettyJson | quote }} - AUTHORIZED_HOST: "{{ .Values.authorizedHost }}" DISABLE_CHALLENGES: "{{ .Values.disableChallenges }}" ENABLE_CAPTCHA: "{{ .Values.enableCaptcha }}" MAX_BALANCE: "{{ .Values.maxBalance }}" REDIS_URL: "{{ .Values.redis.url }}" RPC_URL: "{{ .Values.backendRpcUrl | default .Values.config.network.rpcUrl | required "An rpc url is required." }}" + MIN_TEZ: "{{ .Values.minTez }}" + MAX_TEZ: "{{ .Values.maxTez }}" + MIN_CHALLENGES: "{{ .Values.minChallenges }}" + MAX_CHALLENGES: "{{ .Values.maxChallenges }}" + MAX_CHALLENGES_WITH_CAPTCHA: "{{ .Values.maxChallengesWithCaptcha }}" + CHALLENGE_SIZE: "{{ .Values.challengeSize }}" + DIFFICULTY: "{{ .Values.difficulty }}" diff --git a/charts/tezos-faucet/templates/deployment.yaml b/charts/tezos-faucet/templates/deployment.yaml index 448741519..a97d4aa86 100644 --- a/charts/tezos-faucet/templates/deployment.yaml +++ b/charts/tezos-faucet/templates/deployment.yaml @@ -40,17 +40,6 @@ spec: name: faucet-backend-config - secretRef: name: faucet-backend-secret - env: - # profiles.json is stored in faucet-backend-config instead of in a new - # dedicated configmap. We don't need it to be an env var so we make it - # empty here to counteract envFrom. - - name: profiles.json - value: "" - volumeMounts: - - name: faucet-backend-config - mountPath: /app/dist/profiles.json - subPath: profiles.json - readOnly: true {{- if .Values.enableUI }} - name: faucet image: {{ .Values.images.tezosFaucet }} diff --git a/charts/tezos-faucet/values.yaml b/charts/tezos-faucet/values.yaml index 8eab46a36..f1ae3c5fc 100644 --- a/charts/tezos-faucet/values.yaml +++ b/charts/tezos-faucet/values.yaml @@ -2,8 +2,8 @@ # Faucet frontend: https://github.com/oxheadalpha/tezos-faucet images: - tezosFaucet: ghcr.io/oxheadalpha/tezos-faucet:2.0.0 - tezosFaucetBackend: ghcr.io/oxheadalpha/tezos-faucet-backend:2.0.0 + tezosFaucet: ghcr.io/oxheadalpha/tezos-faucet:2.1.0 + tezosFaucetBackend: ghcr.io/oxheadalpha/tezos-faucet-backend:2.1.0 # Frontend app configuration. You can optionally deploy only the faucet backend. enableUI: true @@ -28,34 +28,26 @@ authorizedHost: "*" backendRpcUrl: http://tezos-node-rpc:8732 # If the backend requires CAPTCHA tokens to be submitted. enableCaptcha: true -# Faucet won't dispense to an address if its balance exceeds this. +# Faucet won't dispense to an address if its balance will exceed this. maxBalance: 6000 - -# Configuration for the faucet profiles. To prevent spamming and abuse, each -# profile has specific parameters that control the distribution of Tez and the -# complexity and number of PoW challenges needed. -# - `profile`: The name of the profile. -# - `amount`: Amount of Tez to be distributed for this profile. -# - `challengesNeeded`: Number of challenges given when CAPTCHA isn't used. -# - `challengesNeededWithCaptcha`: Number of challenges given when CAPTCHA is used. -# - `difficulty`: Challenge difficulty level when CAPTCHA isn't used. -# - `difficultyWithCaptcha`: Challenge difficulty level when CAPTCHA is used. -profiles: - user: - amount: 1 - challengesNeeded: 5 - challengesNeededWithCaptcha: 4 - difficulty: 4 - difficultyWithCaptcha: 3 - baker: - amount: 6000 - challengesNeeded: 6 - challengesNeededWithCaptcha: 5 - difficulty: 5 - difficultyWithCaptcha: 4 +# The minimum Tez allowed per request. +minTez: 1 +# The maximum Tez allowed per request. +maxTez: 6000 # Set to true to disable the requirement of solving PoW challenges. disableChallenges: false +# Minimum number of challenges required for the minimum Tez request. +minChallenges: 1 +# Maximum number of challenges required for the maximum Tez request. +maxChallenges: 550 +# Maximum number of challenges required for the maximum Tez request when a +# captcha is used. +maxChallengesWithCaptcha: 66 +# How many bytes the challenge string should be. +challengeSize: 2048 +# Difficulty level for challenges. +difficulty: 4 # Config for the Redis backend for the PoW challenges. Redis is not needed if # challenges are disabled.