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