-
Notifications
You must be signed in to change notification settings - Fork 578
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fix requestContext load configService
- Loading branch information
1 parent
753cfb4
commit f2c874f
Showing
19 changed files
with
133 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
...idway-core/test/fixtures/app-with-configuration-namespace/base-app-decorator/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"name": "ali-demo" | ||
} |
9 changes: 9 additions & 0 deletions
9
...re/test/fixtures/app-with-configuration-namespace/base-app-decorator/src/configuration.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { Configuration } from '@midwayjs/decorator'; | ||
|
||
@Configuration({ | ||
imports: [ | ||
'../../midway-plugin-mock/src', | ||
'../../midway-plugin-ok/src' | ||
], | ||
}) | ||
export class AutoConfiguraion {} |
21 changes: 21 additions & 0 deletions
21
...core/test/fixtures/app-with-configuration-namespace/base-app-decorator/src/lib/service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { Provide, Inject } from '@midwayjs/decorator'; | ||
|
||
@Provide() | ||
export class BaseService { | ||
|
||
@Inject() | ||
userManager; | ||
|
||
@Inject('midway-plugin-mock:articleManager') | ||
articleManager; | ||
|
||
@Inject('ok:articleManager') | ||
newArticleManager; | ||
|
||
async getInformation() { | ||
const result1 = await this.userManager.getUser(); | ||
const result2 = await this.articleManager.getOne(); | ||
const result3 = await this.newArticleManager.getOne(); | ||
return result1 + ',' + result2 + ',' + result3; | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
.../test/fixtures/app-with-configuration-namespace/base-app-decorator/src/lib/userManager.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { Provide } from '@midwayjs/decorator'; | ||
|
||
@Provide() | ||
export class UserManager { | ||
async getUser() { | ||
return 'harry'; | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
...idway-core/test/fixtures/app-with-configuration-namespace/midway-plugin-mock/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"name": "midway-plugin-mock", | ||
"main": "src/index.ts" | ||
} |
8 changes: 8 additions & 0 deletions
8
...e/test/fixtures/app-with-configuration-namespace/midway-plugin-mock/src/articleManager.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { Provide } from '@midwayjs/decorator'; | ||
|
||
@Provide() | ||
export class ArticleManager { | ||
async getOne() { | ||
return 'one article'; | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
...re/test/fixtures/app-with-configuration-namespace/midway-plugin-mock/src/configuration.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { Configuration } from '@midwayjs/decorator'; | ||
|
||
@Configuration({}) | ||
export class AutoConfiguraion {} |
8 changes: 8 additions & 0 deletions
8
...e/test/fixtures/app-with-configuration-namespace/midway-plugin-mock/src/replaceManager.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { Provide } from '@midwayjs/decorator'; | ||
|
||
@Provide() | ||
export class ReplaceManager { | ||
async getOne() { | ||
return 'one article'; | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
.../midway-core/test/fixtures/app-with-configuration-namespace/midway-plugin-ok/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"name": "midway-plugin-mock", | ||
"main": "src/index.ts" | ||
} |
8 changes: 8 additions & 0 deletions
8
...ore/test/fixtures/app-with-configuration-namespace/midway-plugin-ok/src/articleManager.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { Provide } from '@midwayjs/decorator'; | ||
|
||
@Provide() | ||
export class ArticleManager { | ||
async getOne() { | ||
return 'two article'; | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
...t/fixtures/app-with-configuration-namespace/midway-plugin-ok/src/config/config.default.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export = { | ||
ok: { | ||
text: 'ok' | ||
} | ||
}; |
5 changes: 5 additions & 0 deletions
5
...est/fixtures/app-with-configuration-namespace/midway-plugin-ok/src/config/config.local.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export = { | ||
ok: { | ||
text: 'ok1' | ||
} | ||
}; |
10 changes: 10 additions & 0 deletions
10
...core/test/fixtures/app-with-configuration-namespace/midway-plugin-ok/src/configuration.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Configuration } from '@midwayjs/decorator'; | ||
|
||
@Configuration({ | ||
namespace: 'ok', | ||
importConfigs: [ | ||
'./config/config.default', | ||
'./config/config.local' | ||
] | ||
}) | ||
export class AutoConfiguraion {} |
12 changes: 12 additions & 0 deletions
12
...ore/test/fixtures/app-with-configuration-namespace/midway-plugin-ok/src/replaceManager.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Config, Provide } from '@midwayjs/decorator'; | ||
|
||
@Provide() | ||
export class ReplaceManager { | ||
|
||
@Config('ok.text') | ||
config; | ||
|
||
async getOne() { | ||
return this.config; | ||
} | ||
} |
4 changes: 3 additions & 1 deletion
4
.../midway-core/test/fixtures/app-with-configuration/midway-plugin-mock/src/configuration.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
import { Configuration } from '@midwayjs/decorator'; | ||
|
||
@Configuration({}) | ||
@Configuration({ | ||
namespace: '' | ||
}) | ||
export class AutoConfiguraion {} |
2 changes: 1 addition & 1 deletion
2
...es/midway-core/test/fixtures/app-with-configuration/midway-plugin-ok/src/configuration.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters