This message was deleted.
# general
s
This message was deleted.
s
should just be
Copy code
data: {
    users: secretPassword
  }
n
How would I add more users?
The docs I have seen, show them as being one per line
s
|
is yaml syntax for a multiline string, so you'd never use it when creating a json object (and base64 strings are always single lines anyways) > How would I add more users? this requires knowing a bit more about what you're trying to do. how are you intending the program to consume this secrets info?
can you also give a concrete example of the value of
secretPassword
n
The secretPassword is generated from the command
htpasswd -nb <username> <password> | base64
Here is an example taken from the Trafik website. https://doc.traefik.io/traefik/middlewares/http/basicauth/
Copy code
apiVersion: v1
kind: Secret
metadata:
  name: authsecret
  namespace: default
data:
  users: |2
    dGVzdDokYXByMSRINnVza2trVyRJZ1hMUDZld1RyU3VCa1RycUU4d2ovCnRlc3QyOiRhcHIxJGQ5
    aHI5SEJCJDRIeHdnVWlyM0hQNEVzZ2dQL1FObzAK
s
i'm not sure what the
2
in
|2
means, but here are a couple options that you could do. keep in mind the
data
field must take a single base64 encoded string, but there's also the option of
stringData
which can take a regular string (the base64 encoding will. be done for you)
Copy code
const secretpasswords = [
  'user1:redactedpassword',
  'user2:redactedpassword',
   ...
]

  ...
  stringData: {
    users: secretpasswords.join("\n")
  }
or
Copy code
const encodedSecretpasswords = btoa([
  'user1:redactedpassword',
  'user2:redactedpassword',
   ...
].join("\n"))

  ...
  data: {
    users: encodedSecretpasswords
  }