-
Notifications
You must be signed in to change notification settings - Fork 825
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(cli): refactor api key prompt
- Loading branch information
1 parent
4b5580a
commit de82d67
Showing
10 changed files
with
52 additions
and
163 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
9 changes: 1 addition & 8 deletions
9
packages/amplify-category-api/src/provider-utils/awscloudformation/prompt-to-add-api-key.ts
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
30 changes: 30 additions & 0 deletions
30
...fy-cli/src/__tests__/extensions/amplify-helpers/testData/mockLocalCloud/amplify-meta.json
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 @@ | ||
{ | ||
"api": { | ||
"ampapp": { | ||
"service": "AppSync", | ||
"providerPlugin": "awscloudformation", | ||
"output": { | ||
"authConfig": { | ||
"defaultAuthentication": { | ||
"authenticationType": "AWS_IAM" | ||
}, | ||
"additionalAuthenticationProviders": [ | ||
{ | ||
"authenticationType": "API_KEY", | ||
"apiKeyConfig": { | ||
"apiKeyExpirationDays": 2, | ||
"apiKeyExpirationDate": "2021-08-20T20:38:07.585Z", | ||
"description": "" | ||
} | ||
} | ||
] | ||
}, | ||
"globalSandboxModeConfig": { | ||
"dev": { | ||
"enabled": true | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
packages/amplify-cli/src/extensions/amplify-helpers/prompt-sandbox-mode-api-key.ts
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,19 @@ | ||
import chalk from 'chalk'; | ||
import { $TSContext } from 'amplify-cli-core'; | ||
import { promptToAddApiKey } from 'amplify-category-api'; | ||
import { globalSandboxModeEnabled, showGlobalSandboxModeWarning } from './show-global-sandbox-mode-warning'; | ||
import { apiKeyIsActive, hasApiKey } from './get-api-key-config'; | ||
|
||
export async function promptSandboxModeApiKey(context: $TSContext): Promise<void> { | ||
if (globalSandboxModeEnabled(context)) { | ||
if (!apiKeyIsActive() || !hasApiKey()) { | ||
context.print.info(` | ||
⚠️ WARNING: Global Sandbox Mode has been enabled, which requires a valid API key. If | ||
you'd like to disable, remove ${chalk.green('"type AMPLIFY_GLOBAL @allow_public_data_access_with_api_key"')} | ||
from your GraphQL schema and run 'amplify push' again. If you'd like to proceed with | ||
sandbox mode disabled in '${context.amplify.getEnvInfo().envName}', do not create an API Key. | ||
`); | ||
await promptToAddApiKey(context); | ||
} else showGlobalSandboxModeWarning(context); | ||
} | ||
} |
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
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
111 changes: 0 additions & 111 deletions
111
packages/amplify-graphql-transformer-core/src/transformation/transformer-config.ts
This file was deleted.
Oops, something went wrong.
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