Description
Describe the solution
In the local workers development process, when a worker depends on other workers, and the dependent worker depends on secrets-store secret, this will cause great trouble to the local development process.
When not depending on other workers, we can create an env variable and determine whether it is a string or an Object with a get()
method when using it, for example:
/// Bindings.ts
readonly DATABASE_URL: string | SecretsStoreSecret;
/// Using
const databaseUrl = typeof env.DATABASE_URL === "string" ? env.DATABASE_URL : await env.DATABASE_URL.get();
But this is not a panacea. When one of my workers needs to depend on another worker, and the other worker depends on SecretsStoreSecret, problems arise. Even if I declare { "binding": "API", "service": "api-core", "environment": "dev" },
, it doesn't work at all. Always appears:
Binding Resource Mode
env.DATABASE_URL Secrets Store Secret loca
And wrangler secrets-store secret
is very inconvenient, it needs to be configured once for each worker. The essence of secrets-store is to share secrets between workers.
**Just like Hyperdrive, we can use special variables to override bindings. This can be very useful during development.
Especially when we need to make changes to multiple workers at the same time.**
Metadata
Metadata
Assignees
Labels
Type
Projects
Status