tobogganSe connecter

louise

Clone avec HTTPS, un jeton personnel en mot de passe, ou avec SSH, une clé ajoutée dans vos paramètres.

NomDernier commitDate
src/packages: resilience, throttle and secrets from the apps; fetch.request (ADR 0081)il y a 2 sem.
louise.tomlpackages: resilience, throttle and secrets from the apps; fetch.request (ADR 0081)il y a 2 sem.
README.mdpackages: resilience, throttle and secrets from the apps; fetch.request (ADR 0081)il y a 2 sem.
README.MD

secrets

Secrets from files, the way container secrets are mounted (ADR 0081): a variable NAME may instead be given as NAME_FILE, the path of a file holding it. Pure Louise, no dependencies. Promoted from toki2's and the newsletter's secret_files.

import secrets

let env = fn name { os.env name }
use files <- result.try (secrets.read ["DATABASE_URL", "APP_ROOT_KEY"] env file.read_text)
let setting = fn name { secrets.lookup files env name }
// setting "DATABASE_URL" is the file's content when DATABASE_URL_FILE is
// set, the variable otherwise.
  • Only the names given are read from files; NAME and NAME_FILE both set is an error, as is a file that cannot be read.
  • One trailing newline (\n or \r\n) is dropped, as editors add one.
  • Read once in main, for the server and every command.