mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
refactor(projects): refactor service env config
This commit is contained in:
25
src/typings/app.d.ts
vendored
25
src/typings/app.d.ts
vendored
@ -600,22 +600,29 @@ declare namespace App {
|
||||
|
||||
/** Service namespace */
|
||||
namespace Service {
|
||||
/** The backend service env type */
|
||||
type EnvType = 'dev' | 'test' | 'prod';
|
||||
|
||||
/** Other baseURL key */
|
||||
type OtherBaseURLKey = 'demo';
|
||||
|
||||
/** The backend service config */
|
||||
interface ServiceConfig<T extends OtherBaseURLKey = OtherBaseURLKey> {
|
||||
interface ServiceConfigItem {
|
||||
/** The backend service base url */
|
||||
baseURL: string;
|
||||
/** Other backend service base url map */
|
||||
otherBaseURL: Record<T, string>;
|
||||
/** The proxy pattern of the backend service base url */
|
||||
proxyPattern: string;
|
||||
}
|
||||
|
||||
/** The backend service config map */
|
||||
type ServiceConfigMap = Record<EnvType, ServiceConfig>;
|
||||
interface OtherServiceConfigItem extends ServiceConfigItem {
|
||||
key: OtherBaseURLKey;
|
||||
}
|
||||
|
||||
/** The backend service config */
|
||||
interface ServiceConfig extends ServiceConfigItem {
|
||||
/** Other backend service config */
|
||||
other: OtherServiceConfigItem[];
|
||||
}
|
||||
|
||||
interface SimpleServiceConfig extends Pick<ServiceConfigItem, 'baseURL'> {
|
||||
other: Record<OtherBaseURLKey, string>;
|
||||
}
|
||||
|
||||
/** The backend service response data */
|
||||
type Response<T = unknown> = {
|
||||
|
10
src/typings/env.d.ts
vendored
10
src/typings/env.d.ts
vendored
@ -25,14 +25,20 @@ declare namespace Env {
|
||||
* This prefix is start with the icon prefix
|
||||
*/
|
||||
readonly VITE_ICON_LOCAL_PREFIX: 'local-icon';
|
||||
/** backend service base url */
|
||||
readonly VITE_SERVICE_BASE_URL: string;
|
||||
/**
|
||||
* other backend service base url
|
||||
*
|
||||
* the value is a json
|
||||
*/
|
||||
readonly VITE_OTHER_SERVICE_BASE_URL: string;
|
||||
/**
|
||||
* Whether to enable the http proxy
|
||||
*
|
||||
* Only valid in the development environment
|
||||
*/
|
||||
readonly VITE_HTTP_PROXY?: CommonType.YesOrNo;
|
||||
/** The back service env */
|
||||
readonly VITE_SERVICE_ENV?: App.Service.EnvType;
|
||||
/**
|
||||
* The auth route mode
|
||||
*
|
||||
|
Reference in New Issue
Block a user