I am saving my .env content dynamically from the AWS secrets manager, but I want to save all values just once the server starts. What should be the approach?
I am using TypeScript:
getSecrets("key").then((keys: any) => {
const originalKeys = JSON.parse(keys);
for (const key in originalKeys) {
if (originalKeys.hasOwnProperty(key)) {
appendFileSync(
__dirname + "/.env",
`${key}='${originalKeys[key]}'\n`
);
}
}