Conversation
| if (!config.id || !config.telemetry) { | ||
| // If no id OR telemetry, | ||
| // still write the file with a new ID and/or telemetry | ||
| fs.writeFileSync(configPath, JSON.stringify({ |
There was a problem hiding this comment.
Should we worry at this point that we're about to overwrite a file that isn't a CLI config and error out?
There was a problem hiding this comment.
I don't know that it's a huge concern...
I kind of want to keep the directory flexible in this function, but we could make it less likely to be an issue of wiping something non-cli related by refactoring the config file to be named fa.config.json or faconfig.json to make it more intentional?
Looking at this now, we probably also want to keep any additional data intact for future proofing by spreading the rest of the data from the object (if it exists)
There was a problem hiding this comment.
Can we just ask for confirmation? Something like
WARNING: you're about to overwrite ../whatever/something.json but this doesn't look like a FusionAuth CLI config file. Continue (y/n)?
There was a problem hiding this comment.
@andrewpai looking at this again, this is not happening via CLI commands, but instead via postInstall and via loadConfig (when a config file doesn't exist).
There's currently no mechanism for warning, and it actually doesn't make sense in that regard, since it'll only ever be run in the package
First test cases and setup for testing.
Run either
Locally to try
Currently, this tests the postinstall script