-
Notifications
You must be signed in to change notification settings - Fork 12k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(@angular/cli): allow setting ssl certificate in angular-cli.json (…
…#4730) Currently users must use the --ssl, -ssl-cert, -ssl-key flags to run the server using an ssl certificate. This update allows users to set those options in default.serve so they can just run `ng serve` without any flags.
- Loading branch information
Showing
4 changed files
with
70 additions
and
3 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
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,20 @@ | ||
import { request } from '../../utils/http'; | ||
import { killAllProcesses } from '../../utils/process'; | ||
import { ngServe } from '../../utils/project'; | ||
import { updateJsonFile } from '../../utils/project'; | ||
|
||
export default function() { | ||
return Promise.resolve() | ||
.then(() => updateJsonFile('.angular-cli.json', configJson => { | ||
const app = configJson.defaults; | ||
app.serve = { ssl: true }; | ||
})) | ||
.then(() => ngServe()) | ||
.then(() => request('https://localhost:4200/')) | ||
.then(body => { | ||
if (!body.match(/<app-root>Loading...<\/app-root>/)) { | ||
throw new Error('Response does not match expected value.'); | ||
} | ||
}) | ||
.then(() => killAllProcesses(), (err) => { killAllProcesses(); throw err; }); | ||
} |
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,26 @@ | ||
import { request } from '../../utils/http'; | ||
import { assetDir } from '../../utils/assets'; | ||
import { killAllProcesses } from '../../utils/process'; | ||
import { ngServe } from '../../utils/project'; | ||
import { updateJsonFile } from '../../utils/project'; | ||
|
||
export default function() { | ||
return Promise.resolve() | ||
.then(() => updateJsonFile('.angular-cli.json', configJson => { | ||
const app = configJson.defaults; | ||
app.serve = { | ||
ssl: true, | ||
sslKey: assetDir('ssl/server.key'), | ||
sslCert: assetDir('ssl/server.crt') | ||
}; | ||
})) | ||
.then(() => ngServe()) | ||
.then(() => request('https://localhost:4200/')) | ||
.then(body => { | ||
if (!body.match(/<app-root>Loading...<\/app-root>/)) { | ||
throw new Error('Response does not match expected value.'); | ||
} | ||
}) | ||
.then(() => killAllProcesses(), (err) => { killAllProcesses(); throw err; }); | ||
|
||
} |