Skip to content

Commit 48a6de3

Browse files
committed
fix path configuration
1 parent bf545a0 commit 48a6de3

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

SimpleMailArchiver/SimpleMailArchiver/Data/PathConfig.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
public record class PathConfig
44
{
5-
public string ArchiveBasePath { get; init; } = "";
5+
public string ArchiveBasePath { get; init; } = "/etc/mailarchive";
66

7-
public string ImportBasePath { get; init; } = "";
7+
public string ImportBasePath { get; init; } = "/etc/mailimport";
88

9-
public string AccountConfigsPath { get; init; } = "";
9+
public string AccountConfigsPath { get; init; } = "/etc/mailaccounts";
1010

11-
public string DbPath { get; init; } = "";
11+
public string DbPath { get; init; } = "/etc/maildb";
1212
}

SimpleMailArchiver/SimpleMailArchiver/Services/MessageImportService/MessageImportService.ImportFromServer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ public async Task ImportFromServer(string accountFilename, ImportProgress progre
107107
#if DEBUG
108108
_logger.LogInformation("Debug mode, not deleting on server");
109109
#else
110-
//await folder.AddFlagsAsync(messageToDeleteIds, MessageFlags.Deleted, true, ct);
111-
//await folder.ExpungeAsync(ct);
110+
await folder.AddFlagsAsync(messageToDeleteIds, MessageFlags.Deleted, true, ct);
111+
await folder.ExpungeAsync(ct);
112112
#endif
113113
progress.Report(new ProgressData(
114114
RemoteMessagesDeletedCount: progress.RemoteMessagesDeletedCount + messageToDeleteIds.Count));

SimpleMailArchiver/SimpleMailArchiver/Startup.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@ public Startup(IConfiguration configuration)
1616
{
1717
_appConfig = new PathConfig();
1818
configuration.Bind("Paths", _appConfig);
19-
if (configuration["Paths"] is null)
19+
20+
// load paths from cnfig.json if not set in configuration, mostly used for development overrides
21+
const string configFile = "config.json";
22+
if (configuration["Paths"] is null && File.Exists(configFile))
2023
{
21-
var configFile = "config.json";
22-
if (!File.Exists(configFile)) throw new Exception();
23-
_appConfig = JsonSerializer.Deserialize<PathConfig>(File.ReadAllText(configFile)) ?? throw new Exception();
24+
_appConfig = JsonSerializer.Deserialize<PathConfig>(File.ReadAllText(configFile)) ??
25+
throw new Exception("Deserialization of config.json failed");
2426
}
2527

2628
ConfigRoot = configuration;

0 commit comments

Comments
 (0)