File tree Expand file tree Collapse file tree 4 files changed +50
-0
lines changed Expand file tree Collapse file tree 4 files changed +50
-0
lines changed Original file line number Diff line number Diff line change 1+ import { EggAppConfig , PowerPartial } from 'egg' ;
2+
3+ // for config.{env}.ts
4+ export type DefaultConfig = PowerPartial < EggAppConfig & BizConfig > ;
5+
6+ // app special config scheme
7+ export interface BizConfig {
8+ sourceUrl : string ;
9+ news : {
10+ pageSize : number ;
11+ serverUrl : string ;
12+ } ;
13+ }
14+
15+ export default ( appInfo : EggAppConfig ) => {
16+ const config = < PowerPartial < EggAppConfig > & BizConfig > { } ;
17+
18+ // app special config
19+ config . sourceUrl = `https://github.com/eggjs/examples/tree/master/${ appInfo . name } ` ;
20+ config . news = {
21+ pageSize : 30 ,
22+ serverUrl : 'https://hacker-news.firebaseio.com/v0' ,
23+ } ;
24+
25+ // override config from framework / plugin
26+ config . keys = appInfo . name + '123456' ;
27+
28+ return config ;
29+ } ;
Original file line number Diff line number Diff line change 1+ import { DefaultConfig } from './config.default' ;
2+
3+ export default ( ) => {
4+ const config : DefaultConfig = { } ;
5+ config . news = {
6+ pageSize : 20 ,
7+ } ;
8+ return config ;
9+ } ;
Original file line number Diff line number Diff line change 1+ import { DefaultConfig } from './config.default' ;
2+
3+ export default ( ) => {
4+ const config : DefaultConfig = { } ;
5+ config . news = {
6+ pageSize : 30 ,
7+ } ;
8+ return config ;
9+ } ;
Original file line number Diff line number Diff line change 1+
2+ export default {
3+ } ;
You can’t perform that action at this time.
0 commit comments