-
Notifications
You must be signed in to change notification settings - Fork 196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(cli): do not require PRIVATE_KEY
if using KMS
#2765
Conversation
🦋 Changeset detectedLatest commit: b8b70d1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 24 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
PRIVATE_KEY
if using KMS
packages/cli/src/runDeploy.ts
Outdated
@@ -85,7 +85,7 @@ export async function runDeploy(opts: DeployOptions): Promise<WorldDeploy> { | |||
} | |||
|
|||
const privateKey = process.env.PRIVATE_KEY as Hex; | |||
if (!privateKey) { | |||
if (!opts.awsKmsKeyId && !privateKey) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we move this PK block down under resolvedConfig
so its a bit more localized with the KMS stuff?
and could potentially wrap it in a self invoking function like
const account = keyId ? await kmsKeyToAccount({ keyId }) : (() => {
const privateKey = process.env.PRIVATE_KEY as Hex;
if (!privateKey) {
throw new MUDError(
`Missing PRIVATE_KEY environment variable.
Run 'echo "PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" > .env'
in your contracts directory to use the default anvil private key.`,
);
}
return privateKeyToAccount(privateKey);
})();
or maybe pull that out into something like envPrivateKeyToAccount()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wrapped it all in a self-invoking function! I like that the two environment variables are only used there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and one we might be able to ditch in #2760 ?
No description provided.