Load resolves all runtime settings relative to projectRoot.
(projectRoot string)
| 40 | |
| 41 | // Load resolves all runtime settings relative to projectRoot. |
| 42 | func Load(projectRoot string) Settings { |
| 43 | root := cleanProjectRoot(projectRoot) |
| 44 | dataDir := dataDir() |
| 45 | return Settings{ |
| 46 | ProjectRoot: root, |
| 47 | Token: strings.TrimSpace(os.Getenv(EnvBotToken)), |
| 48 | Locale: envOrDefault(EnvBotLocale, DefaultLocale), |
| 49 | DataDir: dataDir, |
| 50 | DatabaseURL: databaseURL(dataDir), |
| 51 | LocalesDir: filepath.Join(root, "locales"), |
| 52 | LogPath: filepath.Join(root, DefaultLogName), |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | // LoadLegacySnapshot reads the legacy JSON backups if they exist and normalizes |
| 57 | // them into the current runtime model. |
no test coverage detected