冠军

导航

< 2025年3月 >
23 24 25 26 27 28 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 1 2 3 4 5

统计

AlainConfig

核心配置对象。

一个配置对象 AlainConfig, 它有一个默认的

一个配置服务:AlainConfigService

https://github.com/ng-alain/delon/blob/master/packages/util/config/config.types.ts

export interface AlainConfig {
  dataRange?: AlainDateRangePickerConfig;
  exception?: AlainExceptionType;
  errorCollect?: AlainErrorCollectConfig;
  image?: AlainImageConfig;
  loading?: AlainLoadingConfig;
  onboarding?: AlainOnboardingConfig;
  lodop?: AlainLodopConfig;
  pageHeader?: AlainPageHeaderConfig;
  qr?: AlainQRConfig;
  se?: AlainSEConfig;
  sg?: AlainSGConfig;
  sv?: AlainSVConfig;
  st?: AlainSTConfig;
  sf?: AlainSFConfig;
  xlsx?: AlainXlsxConfig;
  zip?: AlainZipConfig;
  pdf?: AlainPdfConfig;
  media?: AlainMediaConfig;
  acl?: AlainACLConfig;
  auth?: AlainAuthConfig;
  cache?: AlainCacheConfig;
  chart?: AlainChartConfig;
  mock?: AlainMockConfig;
  utilArray?: AlainUtilArrayConfig;
  utilCurrency?: AlainUtilCurrencyConfig;
  themeHttp?: AlainThemeHttpClientConfig;
  themeResponsive?: AlainThemeResponsiveConfig;
  themeI18n?: AlainThemeI18nConfig;
}

export const ALAIN_CONFIG = new InjectionToken<AlainConfig>('alain-config', {
  providedIn: 'root',
  factory: ALAIN_CONFIG_FACTORY
});

export function ALAIN_CONFIG_FACTORY(): AlainConfig {
  return {};
}

定义了返回配置的 Token: ALAIN_CONFIG
还有一个返回配置信息的工厂 ALAIN_CONFIG_FACTORY

其中 AlainAuthConfig 的默认值见:https://github.com/ng-alain/delon/blob/master/packages/auth/src/auth.config.ts

import type { AlainAuthConfig, AlainConfigService } from '@delon/util/config';

export const AUTH_DEFAULT_CONFIG: AlainAuthConfig = {
  store_key: `_token`,
  token_invalid_redirect: true,
  token_exp_offset: 10,
  token_send_key: `token`,
  token_send_template: '${token}',
  token_send_place: 'header',
  login_url: '/login',
  ignores: [/\/login/, /assets\//, /passport\//],
  allow_anonymous_key: `_allow_anonymous`,
  executeOtherInterceptors: true,
  refreshTime: 3000,
  refreshOffset: 6000
};

export function mergeConfig(srv: AlainConfigService): AlainAuthConfig {
  return srv.merge('auth', AUTH_DEFAULT_CONFIG)!;
}

posted on   冠军  阅读(73)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
历史上的今天:
2008-03-17 wf工作流 请求的性能计数器不是自定义计数器,它必须初始化为 ReadOnly 问题处理
点击右上角即可分享
微信分享提示