Skip to content

Commit 38f31b5

Browse files
committed
Expose the local path to the certificate from the server
1 parent 3259816 commit 38f31b5

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/httptoolkit-server.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const packageJson = require('../package.json');
1010
const typeDefs = `
1111
type Query {
1212
version: String!
13+
config: InterceptionConfig!
1314
interceptors: [Interceptor!]!
1415
}
1516
@@ -25,6 +26,10 @@ const typeDefs = `
2526
): Boolean!
2627
}
2728
29+
type InterceptionConfig {
30+
certificatePath: String!
31+
}
32+
2833
type Interceptor {
2934
id: ID!
3035
version: String!
@@ -37,11 +42,17 @@ const typeDefs = `
3742
scalar Error
3843
`
3944

40-
const buildResolvers = (interceptors: _.Dictionary<Interceptor>) => {
45+
const buildResolvers = (
46+
config: HtkConfig,
47+
interceptors: _.Dictionary<Interceptor>
48+
) => {
4149
return {
4250
Query: {
4351
version: () => packageJson.version,
4452
interceptors: () => _.values(interceptors),
53+
config: () => ({
54+
certificatePath: config.https.certPath
55+
})
4556
},
4657

4758
Mutation: {
@@ -112,7 +123,7 @@ export class HttpToolkitServer {
112123

113124
this.graphql = new GraphQLServer({
114125
typeDefs,
115-
resolvers: buildResolvers(interceptors)
126+
resolvers: buildResolvers(config, interceptors)
116127
});
117128
}
118129

0 commit comments

Comments
 (0)