-
Notifications
You must be signed in to change notification settings - Fork 35
Add --context-file param to override cdk.context.json #576
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
base: main
Are you sure you want to change the base?
Conversation
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.
Thanks for getting this raised again. Made some comments, we also need unit and integration tests for this.
let PROJECT_CONTEXT = DEFAULT_PROJECT_CONTEXT; | ||
export { PROJECT_CONTEXT }; |
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.
Let's not do this. It's going to be confusing if this value changes bases on whether load()
has been called or not.
You can just update the name of the variable to DEFAULT_PROJECT_CONTEXT
everywhere, or maybe for now just update the docblock.
fs.existsSync(expandHomeDir(userProjectContextFile)) | ||
) { | ||
info(`Using specified project context ${userProjectContextFile}`); | ||
PROJECT_CONTEXT = userProjectContextFile; |
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.
see above
if ( | ||
userProjectContextFile && | ||
typeof userProjectContextFile === 'string' && | ||
fs.existsSync(expandHomeDir(userProjectContextFile)) |
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.
I don't think t the filepath should be considered relative to the user's home directory. It's also not what is done later on.
@@ -122,6 +124,20 @@ export class Configuration { | |||
public async load(): Promise<this> { | |||
const userConfig = await loadAndLog(USER_DEFAULTS); | |||
this._projectConfig = await loadAndLog(PROJECT_CONFIG); | |||
var userProjectContextFile = this.commandLineArguments.subSettings(['contextFile']).get([]); |
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.
I think you'll need to store the value as a class property
@mavwolverine Do you still have the time and interest to move this forward? All good if not. |
@mrgrain |
Pull request was converted to draft
All good and totally understandable! I'm moving this into draft state for now, so we can easily filter it out until you or someone else picks it up again. 👍 |
Fixes ##632
This is replacement for PR aws/aws-cdk#23912
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license