Skip to content

Commit 90df6a5

Browse files
committed
feat: add Resend integration and fix state persistence
1 parent 161cd9d commit 90df6a5

File tree

3 files changed

+301
-5
lines changed

3 files changed

+301
-5
lines changed

.gitignore

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@ bld/
3838
# Environment variables - IMPORTANT: Never commit this!
3939
.env
4040

41-
# State files
42-
/data/
43-
state.json
41+
# State files (old - see bottom for better pattern)
4442

4543
# OS files
4644
.DS_Store
@@ -56,3 +54,7 @@ desktop.ini
5654
# Docker
5755
.dockerignore
5856
docker-compose.override.yml
57+
58+
# Data directory - ignore everything except state.json
59+
data/*
60+
!data/state.json

StateStore.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33

44
public static class StateStore
55
{
6-
static readonly string PathFile = "/data/state.json";
6+
static readonly string DataDir = Environment.GetEnvironmentVariable("DATA_DIR") ?? "./data";
7+
static readonly string PathFile = Path.Combine(DataDir, "state.json");
78
static readonly JsonSerializerOptions J = new() { WriteIndented = true };
89

910
public static StateOfWorld Load()
@@ -14,7 +15,7 @@ public static StateOfWorld Load()
1415

1516
public static void Save(StateOfWorld s)
1617
{
17-
Directory.CreateDirectory("/data");
18+
Directory.CreateDirectory(DataDir);
1819
File.WriteAllText(PathFile, JsonSerializer.Serialize(s, J));
1920
}
2021

0 commit comments

Comments
 (0)