Skip to content

Commit cb08930

Browse files
authored
Merge pull request #55 from supabase-community/refactor-cfn-parameter
chore: refactoring
2 parents 97c37f7 + b57fce5 commit cb08930

File tree

3 files changed

+17
-12
lines changed

3 files changed

+17
-12
lines changed

src/supabase-stack.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -648,11 +648,17 @@ export class SupabaseStack extends FargateStack {
648648
serviceRoleKey: serviceRoleKey.ssmParameter,
649649
});
650650

651+
new cdk.CfnOutput(this, 'StudioUrl', {
652+
value: studio.prodBranchUrl,
653+
description: 'The dashboard for Supabase projects.',
654+
});
655+
651656
new cdk.CfnOutput(this, 'SupabaseUrl', {
652657
value: apiExternalUrl,
653658
description: 'A RESTful endpoint for querying and managing your database.',
654659
exportName: `${cdk.Aws.STACK_NAME}Url`,
655660
});
661+
656662
new cdk.CfnOutput(this, 'SupabasAnonKey', {
657663
value: anonKey.value,
658664
description: 'This key is safe to use in a browser if you have enabled Row Level Security for your tables and configured policies.',

src/supabase-studio.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ export class SupabaseStudio extends Construct {
6767
preBuild: {
6868
commands: [
6969
'echo POSTGRES_PASSWORD=$(aws secretsmanager get-secret-value --secret-id $DB_SECRET_ARN --query SecretString | jq -r . | jq -r .password) >> .env.production',
70-
'echo SUPABASE_ANON_KEY=$(aws ssm get-parameter --region $SSM_REGION --name $ANON_KEY_NAME --query Parameter.Value) >> .env.production',
71-
'echo SUPABASE_SERVICE_KEY=$(aws ssm get-parameter --region $SSM_REGION --name $SERVICE_KEY_NAME --query Parameter.Value) >> .env.production',
70+
'echo SUPABASE_ANON_KEY=$(aws ssm get-parameter --region $SUPABASE_REGION --name $ANON_KEY_NAME --query Parameter.Value) >> .env.production',
71+
'echo SUPABASE_SERVICE_KEY=$(aws ssm get-parameter --region $SUPABASE_REGION --name $SERVICE_KEY_NAME --query Parameter.Value) >> .env.production',
7272
'env | grep -e STUDIO_PG_META_URL >> .env.production',
7373
'env | grep -e SUPABASE_ >> .env.production',
7474
'env | grep -e NEXT_PUBLIC_ >> .env.production',
@@ -124,8 +124,8 @@ export class SupabaseStudio extends Construct {
124124
STUDIO_PG_META_URL: `${supabaseUrl}/pg`,
125125
SUPABASE_URL: `${supabaseUrl}`,
126126
SUPABASE_PUBLIC_URL: `${supabaseUrl}`,
127+
SUPABASE_REGION: serviceRoleKey.env.region,
127128
DB_SECRET_ARN: dbSecret.secretArn,
128-
SSM_REGION: anonKey.env.region,
129129
ANON_KEY_NAME: anonKey.parameterName,
130130
SERVICE_KEY_NAME: serviceRoleKey.parameterName,
131131
},
@@ -173,8 +173,6 @@ export class SupabaseStudio extends Construct {
173173
amplifySSRLoggingPolicy.attachToRole(role);
174174

175175
this.prodBranchUrl = `https://${this.prodBranch.branchName}.${this.app.defaultDomain}`;
176-
177-
new cdk.CfnOutput(this, 'Url', { value: this.prodBranchUrl });
178176
}
179177

180178
}

test/__snapshots__/main.test.ts.snap

Lines changed: 8 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)