Enable accessing secrets store from global context #13456
touhidurrr
started this conversation in
Feature Requests
Replies: 2 comments 1 reply
-
|
This is by design rather than a bug. Moving to discussions as a feature request. |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
The usecase is very common. Without this, it overcomplicates the code. For example with global context: import { REST } from '@discordjs/rest';
const token = await env.DISCORD_TOKEN.get();
const discord = new REST({ version: '10' }).setToken(TOKEN);Without: import { REST } from '@discordjs/rest';
let discord = null;
export const getDiscord = () => {
if (discord) return discord;
const token = await env.DISCORD_TOKEN.get();
discord = new REST({ version: '10' }).setToken(TOKEN);
return discord;
}On some other file & inside some async function: const discord = await getDiscord()
// rest of the workSo, this just makes the code overcomplicated. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
What versions & operating system are you using?
Please provide a link to a minimal reproduction
https://github.com/touhidurrr/uncivgames-dbot/blob/4114b95fd16bc3f3d43dc914fe02bb7314cee613/src/modules/prisma.ts
Describe the Bug
await SecretsStore.get()does not work from global contextPlease provide any relevant error logs
Beta Was this translation helpful? Give feedback.
All reactions