Add config-hooks to call scripts for generation of env values #6

Open
opened 2026-05-12 18:57:28 +00:00 by simon · 1 comment
Member

I don't know if thats the best way to solve it, but I want to automate the generation of ULIDs when configuring matrix-synapse with matrix-authentication-service, see

.env.sample Line 84 in d82d539424
#MAS_UPSTREAM_PROVIDER_ID= # ULID, e.g. 01JSHPZHAXC50QBKH67MH33TNF — generate at https://www.ulidtools.com

So I'm thinking of configuring something in alakazam like

  env-hooks:  # or "config-hooks"
    MAS_UPSTREAM_PROVIDER_ID: generate_ulid

just as a rough idea

I don't know if thats the best way to solve it, but I want to automate the generation of ULIDs when configuring matrix-synapse with matrix-authentication-service, see https://git.coopcloud.tech/coop-cloud/matrix-synapse/src/commit/d82d539424b434c05069d91bcb140dca73da4a52/.env.sample#L84 So I'm thinking of configuring something in alakazam like ``` env-hooks: # or "config-hooks" MAS_UPSTREAM_PROVIDER_ID: generate_ulid ``` just as a rough idea
Owner

In general an env-hook could be useful in some cases. But it must be ensured that the hook command will reproduce deterministic outputs, because the env file need to be regenerated for every update. For generating an ULID it's not useful, because ULIDs are randomly generated and not deterministically.

Another solution could be to run the env-hook only if the env is empty. But this would require a more complex env generation logic:

  1. (additional step) Look if the env file already exists
  2. (additional step) Read all envs
  3. Delete the env file
  4. Regenerate the env file as usual
  5. (additional step) check the read envs from step 2 and run the env-hooks for all empty envs.
In general an `env-hook` could be useful in some cases. But it must be ensured that the hook command will reproduce deterministic outputs, because the env file need to be regenerated for every update. For generating an ULID it's not useful, because ULIDs are randomly generated and not deterministically. Another solution could be to run the `env-hook` only if the env is empty. But this would require a more complex env generation logic: 1. (additional step) Look if the env file already exists 2. (additional step) Read all envs 3. Delete the env file 4. Regenerate the env file as usual 5. (additional step) check the read envs from step 2 and run the env-hooks for all empty envs.
Sign in to join this conversation.
No description provided.