升级版本并改用内部账号存储
This commit is contained in:
+7
-1
@@ -42,7 +42,7 @@ type App struct {
|
||||
products []types.Product
|
||||
productsAt time.Time
|
||||
|
||||
// accountsMu 串行化账号文件修改,避免并发导入、编辑或删除互相覆盖。
|
||||
// accountsMu 串行化内部账号库修改,避免并发导入、编辑或删除互相覆盖。
|
||||
accountsMu sync.Mutex
|
||||
|
||||
closeLog func()
|
||||
@@ -123,8 +123,14 @@ func (a *App) Startup(ctx context.Context) {
|
||||
a.ctx = ctx
|
||||
|
||||
a.paths = config.DefaultAppPaths()
|
||||
configMigrated, configMigrationErr := config.MigrateLegacyFile(a.paths.ConfigFile, a.paths.LegacyConfigFile)
|
||||
a.logStore = logger.NewMemoryLogStore(800)
|
||||
a.closeLog = logger.InitLogging(a.logStore, a.paths.LogDir)
|
||||
if configMigrationErr != nil {
|
||||
logger.LogEvent("配置", "warn", "旧配置迁移失败: %s: %v", a.paths.LegacyConfigFile, configMigrationErr)
|
||||
} else if configMigrated {
|
||||
logger.LogEvent("配置", "success", "已迁移旧配置到应用内部目录: %s", a.paths.ConfigFile)
|
||||
}
|
||||
|
||||
// 加载配置并应用运行时设置
|
||||
a.cfg = config.LoadConfig(a.paths.ConfigFile)
|
||||
|
||||
Reference in New Issue
Block a user