(path: string)
| 775 | }; |
| 776 | |
| 777 | const readSettings = (path: string): Effected<Logging | ReadFile, Settings> => |
| 778 | effected(function* () { |
| 779 | const content = yield* readFile(path); |
| 780 | try { |
| 781 | const settings = JSON.parse(content); |
| 782 | yield* logger.log("Settings loaded"); |
| 783 | return settings; |
| 784 | } catch (e) { |
| 785 | yield* logger.error("Failed to parse settings file:", e); |
| 786 | return defaultSettings; |
| 787 | } |
| 788 | }); |
| 789 | |
| 790 | const readSettingsWithoutLogging = readSettings("settings.json").resume( |
| 791 | (name): name is Logging["name"] => name.startsWith("logging:"), |
no test coverage detected