( https: HttpsServerOptions | undefined, )
| 144 | } |
| 145 | |
| 146 | export async function resolveHttpsConfig( |
| 147 | https: HttpsServerOptions | undefined, |
| 148 | ): Promise<HttpsServerOptions | undefined> { |
| 149 | if (!https) return undefined |
| 150 | |
| 151 | const [ca, cert, key, pfx] = await Promise.all([ |
| 152 | readFileIfExists(https.ca), |
| 153 | readFileIfExists(https.cert), |
| 154 | readFileIfExists(https.key), |
| 155 | readFileIfExists(https.pfx), |
| 156 | ]) |
| 157 | return { ...https, ca, cert, key, pfx } |
| 158 | } |
| 159 | |
| 160 | async function readFileIfExists(value?: string | Buffer | any[]) { |
| 161 | if (typeof value === class="st">'string') { |
no test coverage detected