-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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(toolkit): fix context passed in from command-line #1939
Conversation
Fix issue where context passed in via command-line was ignored. Migration behavior has been changed: context that looks like it has been generated by context providers (keys containing ":") will upon loading be migrated to `cdk.context.json`; other context in `cdk.json` will be left as-is and treated as readonly. Fixes #1911.
@@ -18,10 +18,11 @@ const CONTEXT_KEY = 'context'; | |||
*/ | |||
export class Configuration { | |||
public settings = new Settings(); | |||
public context = new Context(new Settings(), [], new Settings()); | |||
public context = new Context(new Settings()); | |||
|
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.
what's up here?
@@ -18,10 +18,11 @@ const CONTEXT_KEY = 'context'; | |||
*/ | |||
export class Configuration { | |||
public settings = new Settings(); | |||
public context = new Context(new Settings(), [], new Settings()); | |||
public context = new Context(new Settings()); | |||
|
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.
what's up here?
@@ -18,10 +18,11 @@ const CONTEXT_KEY = 'context'; | |||
*/ | |||
export class Configuration { | |||
public settings = new Settings(); | |||
public context = new Context(new Settings(), [], new Settings()); | |||
public context = new Context(new Settings()); | |||
|
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.
what's up here?
this.context = new Context( | ||
this.commandLineContext, | ||
this.projectConfig.subSettings([CONTEXT_KEY]).makeReadOnly(), | ||
this.projectContext); |
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.
This is a bit tricky, can we special-case it a bit more? Feel wrong to migrate all context that has :
in it, or we should block this from user-defined context keys.
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'll agree it's not fantastic, but I'd prefer just to take out the migration behavior a couple of releases in the future (maybe for GA) rather than complicate things now.
|
||
constructor(private readonly bottom: Settings, private readonly bottomPrefixPath: string[], private readonly top: Settings) { | ||
constructor(bag: Settings, ...bags: Settings[]) { | ||
this.bags = [bag, ...bags]; | ||
} |
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.
Throw?
I guess we need an integ test... |
Fix issue where context passed in via command-line was ignored. Migration behavior has been changed: context that looks like it has been generated by context providers (keys containing ":") will upon loading be migrated to `cdk.context.json`; other context in `cdk.json` will be left as-is and treated as readonly. Fixes #1911.
Fix issue where context passed in via command-line was ignored. Migration behavior has been changed: context that looks like it has been generated by context providers (keys containing ":") will upon loading be migrated to `cdk.context.json`; other context in `cdk.json` will be left as-is and treated as readonly. Fixes #1911.
Fix issue where context passed in via command-line was ignored.
Migration behavior has been changed: context that looks like it
has been generated by context providers (keys containing ":")
will upon loading be migrated to
cdk.context.json
; othercontext in
cdk.json
will be left as-is and treated as readonly.Fixes #1911.
Pull Request Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license.