Skip to content

Commit 43fff11

Browse files
committed
Remove backup feature
1 parent 47f29de commit 43fff11

File tree

6 files changed

+1
-95
lines changed

6 files changed

+1
-95
lines changed

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
*.env
33
storage.db
44
logs
5-
backups
65

76
# Generated files
87
obj

Environment.cs

-4
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ public class Environment
1010
public string Token { get; set; } = default!;
1111
public ulong? ServerID { get; set; } = default!;
1212
public List<ulong> Owners { get; set; } = default!;
13-
public TimeSpan BackupInterval { get; set; } = default!;
14-
public int BackupsToKeep { get; set; } = default!;
1513
public int StatusPort { get; set; } = default!;
1614

1715
public static async Task<Environment> Load()
@@ -37,8 +35,6 @@ public static async Task<Environment> Load()
3735
.Split(',')
3836
.Select(x => ulong.Parse(x))
3937
.ToList(),
40-
BackupInterval = TimeSpan.FromMinutes(int.Parse(GetEnv("BACKUP_INTERVAL_MINUTES"))),
41-
BackupsToKeep = int.Parse(GetEnv("BACKUPS_TO_KEEP")),
4238
StatusPort = int.Parse(GetEnv("STATUS_PORT")),
4339
};
4440
}

Program.cs

-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@
3434
var userInfoService = new UserInfoService();
3535
var templateService = new TemplateService(settingsService);
3636
var snapshotService = new SnapshotService(settingsService);
37-
var backupService = new BackupService();
38-
backupService.Init();
3937
var heartbeatService = new HeartbeatService();
4038
heartbeatService.Init();
4139
var commandLoggerService = new CommandLoggerService();

README.md

-4
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,6 @@ Create **development.env** file where you cloned this repository and paste the f
6666
TOKEN=<DISCORD_BOT_ACCESS_TOKEN>
6767
SERVERID=<DISCORD_SERVER_ID>
6868
OWNERS=<DISCORD_USER_ID>
69-
BACKUP_INTERVAL_MINUTES=60
70-
BACKUPS_TO_KEEP=50
7169
STATUS_PORT=8000
7270
```
7371

@@ -97,8 +95,6 @@ To tell the bot which configuration should it use, run it with `--development` o
9795
- TOKEN: Your Discord bot's access token. Anyone with possession of this token can act on your bot's behalf.
9896
- SERVERID: The Server ID where guild scoped commands can be registered. Only used when running in development mode.
9997
- OWNERS: Comma separated list of User IDs who have full access to the bot. Overrides [modranks](#modranks).
100-
- BACKUP_INTERVAL_MINUTES: Minutes between automatic database backups.
101-
- BACKUPS_TO_KEEP: Delete old backups after the number of backups exceeds this.
10298
- STATUS_PORT: Start a web server on this port to appear online for status services.
10399

104100
Commands (including slash commands and context commands) are registered at guild (discord server) scope when using development mode, and global scope when using production mode. Global command registration may take a few seconds or minutes due to Discord's API, but guild scoped commands are almost instant. In order to register commands, you need to run the bot with `--register-commands` parameter. The reason why registering commands is not the default is Discord can rate limit the bot when it tries to register commands over and over again in a short period of time. This can be annoying when debugging.

Services/BackupService.cs

-63
This file was deleted.

nix/module.nix

+1-21
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,6 @@ in
2727
'';
2828
};
2929
settings = {
30-
backups-interval-minutes = mkOption {
31-
type = int;
32-
default = 60;
33-
description = ''
34-
Minutes between automatic database backups.
35-
'';
36-
};
37-
backups-to-keep = mkOption {
38-
type = int;
39-
default = 50;
40-
description = ''
41-
Delete old backups after the number of backups exceeds this.
42-
'';
43-
};
4430
status-port = mkOption {
4531
type = port;
4632
default = 8000;
@@ -80,13 +66,7 @@ in
8066
WorkingDirectory = "/var/moe";
8167
User = "moe";
8268
EnvironmentFile = cfg.credentialsFile;
83-
Environment =
84-
let
85-
backups-interval-minutes = "BACKUP_INTERVAL_MINUTES=${toString cfg.settings.backups-interval-minutes}";
86-
backups-to-keep = "BACKUPS_TO_KEEP=${toString cfg.settings.backups-to-keep}";
87-
status-port = "STATUS_PORT=${toString cfg.settings.status-port}";
88-
in
89-
"${backups-interval-minutes} ${backups-to-keep} ${status-port}";
69+
Environment = "STATUS_PORT=${toString cfg.settings.status-port}";
9070
};
9171
};
9272
};

0 commit comments

Comments
 (0)