@riligar/elysia-backup 1.8.0 → 1.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/package.json +1 -1
- package/src/core/config.js +1 -1
- package/src/index.js +4 -4
package/README.md
CHANGED
|
@@ -41,7 +41,7 @@ const app = new Elysia()
|
|
|
41
41
|
.use(
|
|
42
42
|
r2Backup({
|
|
43
43
|
sourceDir: './data',
|
|
44
|
-
configPath: './config.json',
|
|
44
|
+
configPath: './backup-config.json',
|
|
45
45
|
})
|
|
46
46
|
)
|
|
47
47
|
.listen(3000)
|
|
@@ -60,12 +60,12 @@ On first run, you'll be guided through an onboarding wizard to configure:
|
|
|
60
60
|
|
|
61
61
|
### Plugin Options
|
|
62
62
|
|
|
63
|
-
| Option | Type | Required | Description
|
|
64
|
-
| ------------ | ------ | -------- |
|
|
65
|
-
| `sourceDir` | string | ✅ | Local directory to backup
|
|
66
|
-
| `configPath` | string | ❌ | Path to save runtime config (default: `./config.json`) |
|
|
63
|
+
| Option | Type | Required | Description |
|
|
64
|
+
| ------------ | ------ | -------- | ------------------------------------------------------------- |
|
|
65
|
+
| `sourceDir` | string | ✅ | Local directory to backup |
|
|
66
|
+
| `configPath` | string | ❌ | Path to save runtime config (default: `./backup-config.json`) |
|
|
67
67
|
|
|
68
|
-
### Runtime Configuration (via UI or config.json)
|
|
68
|
+
### Runtime Configuration (via UI or backup-config.json)
|
|
69
69
|
|
|
70
70
|
| Option | Type | Description |
|
|
71
71
|
| ----------------- | -------- | ---------------------------------------------- |
|
package/package.json
CHANGED
package/src/core/config.js
CHANGED
|
@@ -43,7 +43,7 @@ export const saveConfig = async (configPath, config) => {
|
|
|
43
43
|
* @returns {Object} Configuration manager with get/set/save methods
|
|
44
44
|
*/
|
|
45
45
|
export const createConfigManager = initialConfig => {
|
|
46
|
-
const configPath = initialConfig.configPath || './config.json'
|
|
46
|
+
const configPath = initialConfig.configPath || './backup-config.json'
|
|
47
47
|
const savedConfig = loadConfig(configPath)
|
|
48
48
|
|
|
49
49
|
let config = { ...initialConfig, ...savedConfig }
|
package/src/index.js
CHANGED
|
@@ -32,11 +32,11 @@ const sessionManager = createSessionManager()
|
|
|
32
32
|
* @param {string} [config.prefix] - Optional prefix for S3 keys (e.g. 'backups/')
|
|
33
33
|
* @param {string} [config.cronSchedule] - Cron schedule expression
|
|
34
34
|
* @param {boolean} [config.cronEnabled] - Whether the cron schedule is enabled
|
|
35
|
-
* @param {string} [config.configPath] - Path to save runtime configuration (default: './config.json')
|
|
35
|
+
* @param {string} [config.configPath] - Path to save runtime configuration (default: './backup-config.json')
|
|
36
36
|
*/
|
|
37
37
|
export const r2Backup = initialConfig => app => {
|
|
38
38
|
// State to hold runtime configuration (allows UI updates)
|
|
39
|
-
const configPath = initialConfig.configPath || './config.json'
|
|
39
|
+
const configPath = initialConfig.configPath || './backup-config.json'
|
|
40
40
|
|
|
41
41
|
// Load saved config if exists
|
|
42
42
|
let savedConfig = {}
|
|
@@ -52,7 +52,7 @@ export const r2Backup = initialConfig => app => {
|
|
|
52
52
|
|
|
53
53
|
let config = { ...initialConfig, ...savedConfig }
|
|
54
54
|
|
|
55
|
-
// Helper to check if config.json exists and has required fields
|
|
55
|
+
// Helper to check if backup-config.json exists and has required fields
|
|
56
56
|
const hasValidConfig = () => {
|
|
57
57
|
if (!existsSync(configPath)) return false
|
|
58
58
|
try {
|
|
@@ -76,7 +76,7 @@ export const r2Backup = initialConfig => app => {
|
|
|
76
76
|
// Setup initial cron schedule
|
|
77
77
|
scheduler.setup(config.cronSchedule, config.cronEnabled !== false)
|
|
78
78
|
|
|
79
|
-
return app.use(html()).group('/backup', app => {
|
|
79
|
+
return app.use(html({ autoDoctype: 'full' })).group('/backup', app => {
|
|
80
80
|
// Authentication Middleware
|
|
81
81
|
const authMiddleware = context => {
|
|
82
82
|
// Skip auth entirely if no valid config (needs onboarding)
|