This is an automated email from the ASF dual-hosted git repository.

willholley pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/couchdb-helm.git


The following commit(s) were added to refs/heads/main by this push:
     new d340b1e  fix: convert float64s to integers (#127)
d340b1e is described below

commit d340b1e0f938c6b675cf6ddeb5f3c7a031ed3463
Author: Will Holley <[email protected]>
AuthorDate: Fri Jul 14 19:30:24 2023 +0100

    fix: convert float64s to integers (#127)
    
    If a large integer is specifed in values.yaml, it is parsed by Helm
    as a float64. For example:
    
    ```
    couchdbConfig:
      chttpd:
        timeout: 5184000
    ```
    
    If this is converted to a string, it produces `5.184e+06` instead of
    the expected `5184000`.
    
    Given we never expect floats to be specified as configuration values
    to CouchDB, we can workaround this erroneus type conversion by
    casting the float64 back to an integer when rendering the ini file.
    
    This then correctly outputs:
    
    ```
    inifile: |
        [chttpd]
        timeout = 5184000
    ```
    
    Note this will break any genuine uses of float64 types in the
    configuration, though I can't think of any cases where this would be
    valid.
---
 couchdb/Chart.yaml               | 2 +-
 couchdb/templates/configmap.yaml | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/couchdb/Chart.yaml b/couchdb/Chart.yaml
index aeb3551..fb81f90 100644
--- a/couchdb/Chart.yaml
+++ b/couchdb/Chart.yaml
@@ -1,6 +1,6 @@
 apiVersion: v1
 name: couchdb
-version: 4.4.1
+version: 4.4.2
 appVersion: 3.3.2
 description: A database featuring seamless multi-master sync, that scales from
   big data to mobile, with an intuitive HTTP/JSON API and designed for
diff --git a/couchdb/templates/configmap.yaml b/couchdb/templates/configmap.yaml
index 55bbf3b..e9715be 100644
--- a/couchdb/templates/configmap.yaml
+++ b/couchdb/templates/configmap.yaml
@@ -14,7 +14,10 @@ data:
     {{- range $section, $settings := $couchdbConfig -}}
     {{ printf "[%s]" $section }}
     {{ range $key, $value := $settings -}}
-    {{ printf "%s = %s" $key ($value | toString) }}
+    {{- if kindIs "float64" $value }}
+    {{ $value = (int $value) }}
+    {{ end -}}
+    {{ printf "%s = %v" $key $value }}
     {{ end }}
     {{ end }}
 

Reply via email to