Is base64 really the best way to use complex config values

Stuart Bishop stuart.bishop at canonical.com
Thu Jun 8 11:39:55 UTC 2017


On 7 June 2017 at 23:22, Tilman Baumann <tilman.baumann at canonical.com> wrote:
> I see a lot of charms use base64 values in config parameters. Especially
> when the values are stuff like custom templates.
>
> Is this really the way to go? It may avoid shell quoting hell for
> parameters set via command line. (Usually trivial)
> But when set via --file option (which is clearly the better way with
> complex fields) then I have to say the 'here document' features of YAML
> are actually quite good.
>
> The problem I see with bas64 is that nobody can read it without decoding
> it every time.
>
> Opinions?

base64 is occasionally useful for binary data or text in arbitrary
encodings. It is only popular because people keep cargo culting it
into their charms when it is unnecessary. I always call it out in
reviews and get people to switch to unencoded text.

> Just as a example of what I mean:
> application: logstash-supportcloud
> charm: logstash-conf-d
> settings:
>   config:
>     value: |
>            filter {
>                if [message] == "" {
>                    drop { }
>                }
>            }
>            output {
>                gelf {
>                    host => "foobar"
>                    port => "5002"
>                }
>            }

Yes, much better.  It involves teaching people the difference between
> and | in multiline yaml strings.

-- 
Stuart Bishop <stuart.bishop at canonical.com>



More information about the Juju mailing list