Skip to content

Commit

Permalink
fix: change default length for api key back to 7 days (aws-amplify#2507)
Browse files Browse the repository at this point in the history
  • Loading branch information
attilah authored and kaustavghosh06 committed Oct 4, 2019
1 parent 5d29503 commit 6a7e61f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ async function askApiKeyQuestions() {
type: 'input',
name: 'apiKeyExpirationDays',
message: 'After how many days from now the API key should expire (1-365):',
default: 180,
default: 7,
validate: validateDays,
},
];
Expand Down
4 changes: 2 additions & 2 deletions packages/graphql-auth-transformer/src/ModelAuthTransformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,8 @@ export class ModelAuthTransformer extends Transformer {

const apiKeyAuthProvider = authProviders.find(p => p.authenticationType === 'API_KEY');

// Return the found instance or a default instance with 180 days of API key expiration
return apiKeyAuthProvider ? apiKeyAuthProvider.apiKeyConfig : { apiKeyExpirationDays: 180 };
// Return the found instance or a default instance with 7 days of API key expiration
return apiKeyAuthProvider ? apiKeyAuthProvider.apiKeyConfig : { apiKeyExpirationDays: 7 };
}

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/graphql-auth-transformer/src/resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class ResourceFactory {
}),
[ResourceConstants.PARAMETERS.APIKeyExpirationEpoch]: new NumberParameter({
Description: 'The epoch time in seconds when the API Key should expire.' +
' Setting this to 0 will default to 180 days from the deployment date.' +
' Setting this to 0 will default to 7 days from the deployment date.' +
' Setting this to -1 will not create an API Key.',
Default: 0,
MinValue: -1
Expand Down Expand Up @@ -83,7 +83,7 @@ export class ResourceFactory {
}

public makeAppSyncApiKey(apiKeyConfig: Transformer.ApiKeyConfig) {
let expirationDays = 180;
let expirationDays = 7;
if (apiKeyConfig && apiKeyConfig.apiKeyExpirationDays) {
expirationDays = apiKeyConfig.apiKeyExpirationDays;
}
Expand Down

0 comments on commit 6a7e61f

Please sign in to comment.