-
Notifications
You must be signed in to change notification settings - Fork 12
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: fix app.mjs panic and create settings.json on startup #481
Conversation
Signed-off-by: tylerslaton <[email protected]>
72a97c1
to
cead33b
Compare
// If the app settings file doesn't exist, create it with default settings. | ||
if (!existsSync(config.appSettingsFile)) { | ||
writeFileSync( | ||
config.appSettingsFile, // created in config.mjs |
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.
nit: I think this comment is out of date?
config.appSettingsFile, // created in config.mjs | |
config.appSettingsFile, |
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.
Its new, I added it just now. What's wrong with it?
headless: true, | ||
}, | ||
}; | ||
if (existsSync(settingsLocation)) { |
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.
Nit: probably more safe to use default setting when file exists and parsing is correct, otherwise fallback to default file. In case the setting file is corrupted...
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.
@StrongMonkey Can you take another look? I added some things to defend against malformed files.
Signed-off-by: tylerslaton <[email protected]>
4a406cf
There were some issues that were not caught in the last PR because a lot of the reviewers already had settings files. I didn't catch it while programming the settings page up for the same reason, to fix this this PR does 3 things.
#480
https://acorn-io.slack.com/archives/C03FU91U4SX/p1725985732395979