-
Notifications
You must be signed in to change notification settings - Fork 69
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
Make comfy settings instance accessible from anywhere #863
Conversation
const comfySettings = new ComfySettings(installWizard.basePath); | ||
await comfySettings.loadSettings(); | ||
const installation = new ComfyInstallation('started', installWizard.basePath, this.telemetry, comfySettings); | ||
const installation = new ComfyInstallation('started', installWizard.basePath, this.telemetry); | ||
InstallationManager.setReinstallHandler(installation); |
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.
Previously, installWizard
would read existing settings, add install options, then write, then installationManager
would initialize settings.
Now, installWizard
does the same as before but also initializes the settings instance at the same time, making it unecessary for installationManager
to do it.
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.
We have one bug left to squash for 0.4.18, then this PR can be merged immediately after the release is cut.
@@ -102,9 +115,13 @@ export class ComfySettings implements IComfySettings { | |||
const fileContent = await fs.readFile(this.filePath, 'utf8'); | |||
// TODO: Reimplement with validation and error reporting. | |||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment | |||
this.settings = JSON.parse(fileContent); | |||
this.settings = { ...this.settings, ...JSON.parse(fileContent) }; |
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.
Flagging just in case: Not sure if this is a runtime change to settings or not (e.g. if setting has been changed in existing user file then later reset, does this result in a net change?).
Changes
ComfySettings
to use same initialization and access pattern asDesktopConfig
, making the current instance accessible from any module.This enables the Sentry class to check whether the user consents to metrics during the installation process, so that installation errors can be manually captured and sent to Sentry. Previously, Sentry was not able to easily access the current settings instance.
┆Issue is synchronized with this Notion page by Unito