update env
This commit is contained in:
parent
248e045c63
commit
ee9f84a64c
10
package.json
10
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@kevisual/use-config",
|
"name": "@kevisual/use-config",
|
||||||
"version": "1.0.17",
|
"version": "1.0.18",
|
||||||
"types": "dist/config.d.ts",
|
"types": "dist/config.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "npm run clean && tsup",
|
"build": "npm run clean && tsup",
|
||||||
@ -20,18 +20,18 @@
|
|||||||
"license": "UNLICENSED",
|
"license": "UNLICENSED",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^22.14.1",
|
"@types/node": "^22.15.30",
|
||||||
"dotenv": "^16.5.0",
|
"dotenv": "^16.5.0",
|
||||||
"fast-glob": "^3.3.3",
|
"fast-glob": "^3.3.3",
|
||||||
"json-schema-to-ts": "^3.1.1",
|
"json-schema-to-ts": "^3.1.1",
|
||||||
"json5": "^2.2.3",
|
"json5": "^2.2.3",
|
||||||
"tsup": "^8.4.0",
|
"tsup": "^8.5.0",
|
||||||
"typescript": "^5.8.3"
|
"typescript": "^5.8.3"
|
||||||
},
|
},
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"import": "./dist/config.mjs",
|
"import": "./dist/env.mjs",
|
||||||
"types": "./dist/config.d.ts"
|
"types": "./dist/env.d.ts"
|
||||||
},
|
},
|
||||||
"./env": {
|
"./env": {
|
||||||
"import": "./dist/env.mjs",
|
"import": "./dist/env.mjs",
|
||||||
|
12
src/env.ts
12
src/env.ts
@ -5,17 +5,17 @@ import { fileURLToPath } from 'url';
|
|||||||
|
|
||||||
// 配置类型
|
// 配置类型
|
||||||
export type Config = {
|
export type Config = {
|
||||||
PORT: number;
|
PORT: string;
|
||||||
// redis
|
// redis
|
||||||
REDIS_HOST?: string;
|
REDIS_HOST?: string;
|
||||||
REDIS_PORT?: number;
|
REDIS_PORT?: string;
|
||||||
REDIS_PASSWORD?: string;
|
REDIS_PASSWORD?: string;
|
||||||
REDIS_VERSION?: string;
|
REDIS_VERSION?: string;
|
||||||
REDIS_DB?: number;
|
REDIS_DB?: string;
|
||||||
REDIS_USER?: string;
|
REDIS_USER?: string;
|
||||||
// postgres
|
// postgres
|
||||||
POSTGRES_HOST?: string;
|
POSTGRES_HOST?: string;
|
||||||
POSTGRES_PORT?: number;
|
POSTGRES_PORT?: string;
|
||||||
POSTGRES_PASSWORD?: string;
|
POSTGRES_PASSWORD?: string;
|
||||||
POSTGRES_USER?: string;
|
POSTGRES_USER?: string;
|
||||||
POSTGRES_DB?: string;
|
POSTGRES_DB?: string;
|
||||||
@ -24,14 +24,14 @@ export type Config = {
|
|||||||
MINIO_BUCKET_NAME?: string;
|
MINIO_BUCKET_NAME?: string;
|
||||||
MINIO_ACCESS_KEY?: string;
|
MINIO_ACCESS_KEY?: string;
|
||||||
MINIO_SECRET_KEY?: string;
|
MINIO_SECRET_KEY?: string;
|
||||||
MINIO_USE_SSL?: boolean;
|
MINIO_USE_SSL?: string;
|
||||||
// mongo
|
// mongo
|
||||||
MONGO_URI?: string;
|
MONGO_URI?: string;
|
||||||
//
|
//
|
||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
};
|
};
|
||||||
export const initConfig: Config = {
|
export const initConfig: Config = {
|
||||||
PORT: 3000,
|
PORT: '3000',
|
||||||
};
|
};
|
||||||
export const fileIsExist = (path: string) => {
|
export const fileIsExist = (path: string) => {
|
||||||
try {
|
try {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user