-
Notifications
You must be signed in to change notification settings - Fork 1
/
s3b.config.js
70 lines (54 loc) · 2.38 KB
/
s3b.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import { config } from "dotenv";
config()
import path from "path";
import { getCloudPath } from "./src/libs/filesystem.js";
//#region ==================================== Replace ====================================
// HOST_URL defines the hostname for the server
// including the port number.
// This should be updated in production or
// if the server is hosted on a different machine.
export const HOST_URL = 'https://cdn.example.com' // Replace it...
//..
export const BUCKETS = [ // Replace it...
{
bucketId: 'example-project-7asd8bjh6', // Never use `bucket` keyword in bucket id
apiKey: '4aeec9284e1044168e76652509dea893',
apiSecret: '797dce9d43e06f4283944c085b627e6232f1257ea603d270fa7e848821abe4f7',
}
]
//#endregion ==================================== Replace ====================================
// Server configuration variables
// PORT specifies the port number on which the
// server will listen for incoming requests.
export const PORT = 8800;
// API_VERSION is used to version the API endpoints.
// This allows for backward compatibility if the API changes in the future.
export const API_VERSION = "v1";
// API_BASE constructs the base URL for the API endpoints using the version number.
export const API_BASE = `/api/${API_VERSION}`;
// Path configuration variables
// CLOUD_BASE_PATH sets the base directory for storing all cloud-related files.
// By default, it creates a directory named `/volume/s3b-cloud` in linux,
// And `C:/s3b-cloud` in windows.
// Make sure this directories has sufficient privilege
export const CLOUD_BASE_PATH = await getCloudPath();
// BUCKET_PATH is the directory path where uploaded files will be stored.
export const BUCKET_PATH = path.join(CLOUD_BASE_PATH, 'bucket');
// File upload configuration
// MAX_FILE_SIZE sets the maximum allowed file size for uploads.
// This is important for controlling the resource usage
// on the server and can be adjusted based on requirements.
// Note: Ensure your proxy server (e.g., Nginx, Apache)
// is also configured to allow the same or higher file size limit.
export const MAX_FILE_SIZE = '50mb';
export const MAX_FILES_LENGTH = 20;
// Export default object containing all configurations
export default {
PORT,
API_VERSION,
API_BASE,
HOST_URL,
CLOUD_BASE_PATH,
BUCKET_PATH,
MAX_FILE_SIZE,
};