fix(paths): Update directory paths to use a dedicated data directory and add ensureDirectories function for proper directory creation.
This commit is contained in:
parent
c084de9c78
commit
e9b2ec0f59
@ -1,5 +1,12 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2025-03-15 - 1.1.1 - fix(paths)
|
||||||
|
Update directory paths to use a dedicated 'data' directory and add ensureDirectories function for proper directory creation.
|
||||||
|
|
||||||
|
- Refactored ts/paths.ts to define a base data directory using process.cwd().
|
||||||
|
- Reorganized MTA directories (keys, dns, emails sent/received/failed, logs) under the data directory.
|
||||||
|
- Added ensureDirectories function to create missing directories at runtime.
|
||||||
|
|
||||||
## 2025-03-15 - 1.1.1 - fix(mta)
|
## 2025-03-15 - 1.1.1 - fix(mta)
|
||||||
Refactor API Manager and DKIMCreator: remove Express dependency in favor of Node's native HTTP server, add an HttpResponse helper to improve request handling, update path and authentication logic, and expose previously private DKIMCreator methods for API access.
|
Refactor API Manager and DKIMCreator: remove Express dependency in favor of Node's native HTTP server, add an HttpResponse helper to improve request handling, update path and authentication logic, and expose previously private DKIMCreator methods for API access.
|
||||||
|
|
||||||
|
29
ts/paths.ts
29
ts/paths.ts
@ -1,12 +1,29 @@
|
|||||||
import * as plugins from './plugins.js';
|
import * as plugins from './plugins.js';
|
||||||
|
|
||||||
|
// Base directories
|
||||||
|
export const baseDir = process.cwd();
|
||||||
export const packageDir = plugins.path.join(
|
export const packageDir = plugins.path.join(
|
||||||
plugins.smartpath.get.dirnameFromImportMetaUrl(import.meta.url),
|
plugins.smartpath.get.dirnameFromImportMetaUrl(import.meta.url),
|
||||||
'../'
|
'../'
|
||||||
);
|
);
|
||||||
export const assetsDir = plugins.path.join(packageDir, './assets');
|
export const dataDir = plugins.path.join(baseDir, 'data');
|
||||||
export const keysDir = plugins.path.join(assetsDir, './keys');
|
|
||||||
export const dnsRecordsDir = plugins.path.join(assetsDir, './dns-records');
|
// MTA directories
|
||||||
export const sentEmailsDir = plugins.path.join(assetsDir, './sent-emails');
|
export const keysDir = plugins.path.join(dataDir, 'keys');
|
||||||
export const receivedEmailsDir = plugins.path.join(assetsDir, './received-emails');
|
export const dnsRecordsDir = plugins.path.join(dataDir, 'dns');
|
||||||
plugins.smartfile.fs.ensureDirSync(keysDir);
|
export const sentEmailsDir = plugins.path.join(dataDir, 'emails', 'sent');
|
||||||
|
export const receivedEmailsDir = plugins.path.join(dataDir, 'emails', 'received');
|
||||||
|
export const failedEmailsDir = plugins.path.join(dataDir, 'emails', 'failed'); // For failed emails
|
||||||
|
export const logsDir = plugins.path.join(dataDir, 'logs'); // For logs
|
||||||
|
|
||||||
|
// Create directories if they don't exist
|
||||||
|
export function ensureDirectories() {
|
||||||
|
// Ensure data directories
|
||||||
|
plugins.smartfile.fs.ensureDirSync(dataDir);
|
||||||
|
plugins.smartfile.fs.ensureDirSync(keysDir);
|
||||||
|
plugins.smartfile.fs.ensureDirSync(dnsRecordsDir);
|
||||||
|
plugins.smartfile.fs.ensureDirSync(sentEmailsDir);
|
||||||
|
plugins.smartfile.fs.ensureDirSync(receivedEmailsDir);
|
||||||
|
plugins.smartfile.fs.ensureDirSync(failedEmailsDir);
|
||||||
|
plugins.smartfile.fs.ensureDirSync(logsDir);
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user