File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -66,6 +66,25 @@ pluginBasicSsl({
6666});
6767```
6868
69+ ### selfsignedAttrs
70+
71+ Attributes passing to ` selfsigned ` , see [ selfsigned] ( https://github.com/jfromaniello/selfsigned ) for details.
72+
73+ - ** Type:** ` CertificateField[] `
74+ - ** Default:**
75+
76+ ``` ts
77+ const defaultAttrs = [{ name: " commonName" , value: " localhost" }];
78+ ```
79+
80+ - ** Example:**
81+
82+ ``` ts
83+ pluginBasicSsl ({
84+ selfsignedAttrs: [{ name: " commonName" , value: " example.com" }],
85+ });
86+ ```
87+
6988### selfsignedOptions
7089
7190Options passing to ` selfsigned ` , see [ selfsigned - Options] ( https://github.com/jfromaniello/selfsigned?tab=readme-ov-file#options ) for details.
Original file line number Diff line number Diff line change 11import type { RsbuildPlugin } from '@rsbuild/core' ;
2- import type { SelfsignedOptions } from 'selfsigned' ;
2+ import type { SelfsignedOptions , generate } from 'selfsigned' ;
33import { resolveHttpsConfig } from './util.js' ;
44
55export const PLUGIN_BASIC_SSL_NAME = 'rsbuild:basic-ssl' ;
@@ -15,6 +15,10 @@ export type PluginBasicSslOptions = {
1515 * @default __dirname
1616 */
1717 outputPath ?: string ;
18+ /**
19+ * Attributes passing to `selfsigned`.
20+ */
21+ selfsignedAttrs ?: Parameters < typeof generate > [ 0 ] ;
1822 /**
1923 * Options passing to `selfsigned`.
2024 */
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ export const resolveHttpsConfig = async (
5757 }
5858
5959 const pem = selfsigned . generate (
60- [ { name : 'commonName' , value : 'localhost' } ] ,
60+ options . selfsignedAttrs ?? [ { name : 'commonName' , value : 'localhost' } ] ,
6161 selfsignedOptions ,
6262 ) ;
6363
You can’t perform that action at this time.
0 commit comments