-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
39 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
export const IS_PRODUCTION = process.env.IS_PRODUCTION === 'true'; | ||
export const AUTH_SECRET = process.env.AUTH_SECRET ?? ''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { Secret } from 'aws-cdk-lib/aws-secretsmanager'; | ||
import { Config, StackContext } from 'sst/constructs'; | ||
|
||
export function Secrets({ stack }: StackContext) { | ||
const secretsArn = process.env.SECRETS_ARN; | ||
|
||
// needed for NEXTAUTH_SECRET env var since there is no way to provide it via SST Config | ||
let secrets; | ||
if (secretsArn) { | ||
// import | ||
secrets = Secret.fromSecretCompleteArn(stack, 'Secrets', secretsArn); | ||
} else { | ||
secrets = secretsArn | ||
? Secret.fromSecretCompleteArn(stack, 'Secrets', secretsArn) | ||
: new Secret(stack, 'App', { | ||
description: `${stack.stackName} ${stack.stage} secrets`, | ||
// secret default template | ||
generateSecretString: { | ||
secretStringTemplate: JSON.stringify({ RANDOM: 'AUTH_SECRET' }), | ||
generateStringKey: 'AUTH_SECRET', | ||
excludePunctuation: true, | ||
}, | ||
}); | ||
} | ||
|
||
// add more SST secrets here | ||
const SECRET_1 = new Config.Secret(stack, 'SECRET_1'); | ||
|
||
return { secrets, SECRET_1 }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters