Saving token between builds

Is it possible to save a token defined in Variables & Secrets under worker settings, such that it will be saved and persistent between builds ?
No description
4 Replies
i40west
i40west2w ago
There's nothing special to do; if you define them they will stay. However, if you have variables defined in your Wrangler config (wrangler.toml or similar) then all variables must be defined there, and only Secrets can be done via the dashboard. If your variables are disappearing it may be due to this conflict?
centml-pavel
centml-pavelOP2w ago
yes they are disappearing after each build my variables in wrangler.toml are of the type [triggers] [observability.logs] [[kv_namespaces]] which is something I would expect to define via code ...however I do not want to put a token in the file (not a best practice) so I was hoping to define the token externally ...but it does not persist.
i40west
i40west2w ago
If you make it a Secret it will persist. Regular variables must be all in one place or the other. Indeed, if it's an API token or something like it, it really should be a Secret.
centml-pavel
centml-pavelOP7d ago
yes looks like this change resolved my problem - thank you for your help !

Did you find this page helpful?