Skip to content

Commit

Permalink
Bail if there's no access token
Browse files Browse the repository at this point in the history
This is better than quietly failing later on, with a bogus token.

Signed-off-by: Michael Bridgen <[email protected]>
  • Loading branch information
squaremo committed Oct 21, 2022
1 parent c9709e4 commit 9fa7e96
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion examples/flux-source/app/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,15 @@ const gitRepo = new k8s.apiextensions.CustomResource("pko-dev", {
},
});

const pulumiToken = process.env['PULUMI_ACCESS_TOKEN'];
if (!pulumiToken) {
throw new Error('This stack needs a Pulumi access token in the environment variable PULUMI_ACCESS_TOKEN')
}

// A secret with the Pulumi access token, taken from the environment.
const tokenSecret = new k8s.core.v1.Secret("pulumi-token", {
stringData: {
'PULUMI_ACCESS_TOKEN': process.env['PULUMI_ACCESS_TOKEN'] || 'token',
'PULUMI_ACCESS_TOKEN': pulumiToken,
},
});

Expand Down

0 comments on commit 9fa7e96

Please sign in to comment.