From 55ee748b070031a8eba18ee2bdc758ad8a575772 Mon Sep 17 00:00:00 2001 From: Aryeh Harris Date: Thu, 17 Aug 2023 23:04:01 -0400 Subject: [PATCH] Update and cleanup values.yaml --- charts/tezos-faucet/templates/configmap.yaml | 20 +++-- charts/tezos-faucet/templates/deployment.yaml | 4 +- charts/tezos-faucet/values.yaml | 84 +++++++++++++------ 3 files changed, 72 insertions(+), 36 deletions(-) diff --git a/charts/tezos-faucet/templates/configmap.yaml b/charts/tezos-faucet/templates/configmap.yaml index ced1f7b96..da2c90e2f 100644 --- a/charts/tezos-faucet/templates/configmap.yaml +++ b/charts/tezos-faucet/templates/configmap.yaml @@ -1,11 +1,17 @@ apiVersion: v1 -data: - config.json: | -{{ .Values.config | mustToPrettyJson | indent 4 }} kind: ConfigMap metadata: name: faucet-config 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 }} +{{ .Values.config | mustToPrettyJson | indent 4 }} + --- apiVersion: v1 kind: ConfigMap @@ -13,9 +19,9 @@ metadata: name: faucet-backend-config namespace: {{ .Release.Namespace }} data: - FAUCET_ADDRESS: {{ .Values.config.network.faucetAddress }} - RPC_URL: {{ .Values.config.network.rpcUrl }} AUTHORIZED_HOST: {{ .Values.authorizedHost }} - FAUCET_AMOUNT_USER: "{{ .Values.config.application.profiles.user.amount}}" - FAUCET_AMOUNT_BAKER: "{{ .Values.config.application.profiles.baker.amount}}" + DISABLE_CHALLENGES: "{{ .Values.disableChallenges }}" + ENABLE_CAPTCHA: "{{ .Values.enableCaptcha }}" MAX_BALANCE: "{{ .Values.maxBalance }}" + REDIS_URL: {{ .Values.redis.url }} + RPC_URL: {{ .Values.config.network.rpcUrl }} diff --git a/charts/tezos-faucet/templates/deployment.yaml b/charts/tezos-faucet/templates/deployment.yaml index e8d12d954..acf6a2bdd 100644 --- a/charts/tezos-faucet/templates/deployment.yaml +++ b/charts/tezos-faucet/templates/deployment.yaml @@ -18,7 +18,7 @@ spec: checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} spec: containers: - - image: {{ .Values.images.tezos_faucet_backend }} + - image: {{ .Values.images.tezosFaucetBackend }} name: faucet-backend ports: - name: backend @@ -29,7 +29,7 @@ spec: name: faucet-backend-config - secretRef: name: faucet-backend-secret - - image: {{ .Values.images.tezos_faucet }} + - image: {{ .Values.images.tezosFaucet }} name: faucet ports: - name: frontend diff --git a/charts/tezos-faucet/values.yaml b/charts/tezos-faucet/values.yaml index 8d5d78b05..840c9f6a7 100644 --- a/charts/tezos-faucet/values.yaml +++ b/charts/tezos-faucet/values.yaml @@ -1,33 +1,63 @@ -images: - tezos_faucet: ghcr.io/oxheadalpha/tezos-faucet:latest - tezos_faucet_backend: ghcr.io/oxheadalpha/tezos-faucet-backend:latest -authorizedHost: "'*'" +# Faucet backend: https://github.com/oxheadalpha/tezos-faucet-backend +# Faucet frontend: https://github.com/oxheadalpha/tezos-faucet -# if your balance is over the max, the faucet won't give you more tokens -maxBalance: 12000 +images: + tezosFaucet: ghcr.io/oxheadalpha/tezos-faucet:latest + tezosFaucetBackend: ghcr.io/oxheadalpha/tezos-faucet-backend:latest +# Frontend application configuration. config: application: - name: "Tezos Jakartanet faucet" - googleCaptchaSiteKey: #6LeiK14fAAAAAPptX4v49I4wSrHjOrU2cb_y5oII - backendUrl: "http://localhost:3000" - githubRepo: "https://github.com/oxheadalpha/tezos-faucet" - profiles: - user: - profile: USER - amount: 1 - baker: - profile: BAKER - amount: 6000 + name: "Tezos Faucet" + googleCaptchaSiteKey: "" # 6LefC8QmAAAAAIX... + backendUrl: "" # http://faucet-backend:3000 + githubRepo: https://github.com/oxheadalpha/tezos-faucet network: - name: #Jakartanet - rpcUrl: #https://jakartanet.tezos.marigold.dev/ - faucetAddress: #tz1cpdS3qoQBYCGohszPWS8Gdya6Wg2e4JnL - viewer: #https://jakarta.tzstats.com - allowSendButton: true -service: - type: ClusterIP - port: 8080 + name: Custom + rpcUrl: "" # http://tezos-node-rpc:8732 + faucetAddress: "" # tz1PW... + viewer: "" # https://network.tzstats.com + +# Value the server sets for the "Access-Control-Allow-Origin" header for CORS. +authorizedHost: "*" +# If the backend requires captcha/ +enableCaptcha: true +# Faucet won't dispense to an address if its balance exceeds this. +maxBalance: 6000 + +# Configuration for the faucet profiles. Each profile (e.g., 'user', 'baker') has specific parameters: +# - `profile`: The name of the profile. +# - `amount`: The amount of Tez to be distributed for this profile. +# - `challengesNeeded`: The number of PoW challenges to be solved when a CAPTCHA is not used. +# - `challengesNeededWithCaptcha`: The number of PoW challenges to be solved when a CAPTCHA is used. +# - `difficulty`: The difficulty level of the PoW challenge when a CAPTCHA is not used. +# - `difficultyWithCaptcha`: The difficulty level of the PoW challenge when a CAPTCHA is used. +# These parameters control the distribution of Tez and the complexity of challenges to prevent spamming and abuse. +profiles: + user: + profile: USER + amount: 1 + challengesNeeded: 5 + challengesNeededWithCaptcha: 4 + difficulty: 4 + difficultyWithCaptcha: 3 + baker: + profile: BAKER + amount: 6000 + challengesNeeded: 6 + challengesNeededWithCaptcha: 5 + difficulty: 5 + difficultyWithCaptcha: 4 + +# Set to true to disable the requirement of solving PoW challenges. +disableChallenges: false + +# Config for the Redis backend for the PoW challenges. Redis is not needed if +# challenges are disabled. +redis: + url: "" # redis://redis-master.redis:6379 + password: "" + ingress: enabled: false className: "" @@ -41,5 +71,5 @@ ingress: # - chart-example-frontend.local # Secrets -googleCaptchaSecretKey: secret_key_goes_here -faucetPrivateKey: edsk*** +googleCaptchaSecretKey: "" # 6LefC8QmAAAAAPH... +faucetPrivateKey: "" # edsk3X...