Angular 6 angular.json 在配置中添加 ssl

Angular 6 angular.json add ssl in configuration

我想通过 SSL 为我的应用程序提供服务我之前有这个脚本:

ng serve --ssl --ssl-key "pathtokey\key.crt"

我想在新 angular.json 中添加 SSL,但是当我尝试添加它时出现错误:

Schema validation failed with the following errors:
 Data path "" should NOT have additional properties(ssl).

在 angular cli 6 中使用 SSL 的正确方法是什么?

在angular.json中:

"serve": {
    "builder": "@angular-devkit/build-angular:dev-server",
    "options": {
        "browserTarget": "app:build",
        "ssl": true,
        "sslKey": "path to .key",
        "sslCert": "path to .crt"
    },
    ...
}

ANGULAR 6 要求您定义参数:--ssl-key & --ssl-cert

创建或获取受信任的证书密钥和证书文件并将其放在 C:\certificates\

ng serve --ssl --ssl-key c:\certificates\server.key  --ssl-cert c:\certificates\server.crt