Skip to content

Commit

Permalink
Merge pull request #31 from fastly/peba/fix-error-reporting
Browse files Browse the repository at this point in the history
🔊fix error reporting
  • Loading branch information
psbanka committed Feb 27, 2019
2 parents 5e0cd98 + bf1d6fb commit 9efa751
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 45 deletions.
87 changes: 62 additions & 25 deletions CHANGELOG.md
@@ -1,42 +1,79 @@
### 2.0.0
## 2.0.1

* Rename package from heroku-fastly to @fastly/heroku-plugin
### Added

### 1.0.7
- 🔊 better error reporting

* Use api.fastly.com instead of app.fastly.com for API access
### Changed

### 1.0.6
- 📝 Changelog now in https://keepachangelog.com/en/1.0.0/ format

* update dependencies
## 2.0.0

### 1.0.5
### Changed

* downgrade heroku-cli-util dependency
- Rename package from heroku-fastly to @fastly/heroku-plugin

### 1.0.4
## 1.0.7

* upgrade heroku-cli-util dependency
### Changed

### 1.0.3
- Use api.fastly.com instead of app.fastly.com for API access

* set `files` in `package.json`, as now required by ocliff
## 1.0.6

### 1.0.2
### Changed

* improve messaging of `tls` and `verify` commands
* add soft-purge option
* upgrade `fastly` dependency
* display CNAME when verification is complete
- update dependencies

### 1.0.0
## 1.0.5

* first implementation of `verify` command
* improve messaging of `tls` command
* less logging
### Changed

### 0.0.3
- downgrade heroku-cli-util dependency

* output copyable metatag for `dns` and `url` verifications
* `tls` command prints CNAME
* improve help text
## 1.0.4

### Changed

- upgrade heroku-cli-util dependency

## 1.0.3

### Changed

- set `files` in `package.json`, as now required by ocliff

## 1.0.2

### Added

- improve messaging of `tls` and `verify` commands
- add soft-purge option
- display CNAME when verification is complete

### Changed

- upgrade `fastly` dependency

## 1.0.0

### Added

- first implementation of `verify` command
- improve messaging of `tls` command

### Changed

- less logging

## 0.0.3

### Added

- `tls` command prints CNAME
- improve help text

### Changed

- output copyable metatag for `dns` and `url` verifications
54 changes: 35 additions & 19 deletions commands/tls.js
Expand Up @@ -73,16 +73,17 @@ Usage: \n\
}
)
} else {
const form = {
domain: context.args.domain,
verification_type: 'dns', // eslint-disable-line camelcase
service_id: config.FASTLY_SERVICE_ID, // eslint-disable-line camelcase
}
request(
{
method: 'POST',
url: `${baseUri}/plugin/heroku/tls`,
headers: { 'Fastly-Key': apiKey, 'Content-Type': 'application/json' },
form: {
domain: context.args.domain,
verification_type: 'dns', // eslint-disable-line camelcase
service_id: config.FASTLY_SERVICE_ID, // eslint-disable-line camelcase
},
form,
},
function(err, response, body) {
if (response.statusCode != 200) {
Expand All @@ -93,20 +94,35 @@ Usage: \n\
)
process.exit(1)
} else {
const json = JSON.parse(body)
hk.styledHeader(
`Domain ${
context.args.domain
} has been queued for TLS certificate addition. This may take a few minutes.`
)
hk.warn(
'In the mean time, start the domain verification process by creating a DNS TXT record containing the following content: \n'
)
hk.warn(json.metatag)
hk.warn(
'Once you have added this TXT record you can start the verification process by running:\n'
)
hk.warn('$ heroku fastly:verify start DOMAIN —app APP')
const output = JSON.parse(body)
if (Array.isArray(output.msg)) {
output.msg.forEach(message => {
if (!message.success) {
if (Array.isArray(message.errors)) {
message.errors.forEach(error => hk.error(error))
}
}
})
}
if (output.metatag) {
hk.styledHeader(
`Domain ${
context.args.domain
} has been queued for TLS certificate addition. This may take a few minutes.`
)
hk.warn(
'In the mean time, start the domain verification process by creating a DNS TXT record containing the following content: \n'
)
hk.warn(output.metatag)
hk.warn(
'Once you have added this TXT record you can start the verification process by running:\n'
)
hk.warn('$ heroku fastly:verify start DOMAIN —app APP')
} else {
hk.warn(
'Unable to process this request. Please wait a few minutes and try your request again. If the problem persists, please contact support@fastly.com ❤️'
)
}
}
}
)
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "@fastly/heroku-plugin",
"version": "2.0.0",
"version": "2.0.1",
"description": "Heroku CLI Plugin for interacting with Fastly CDN",
"homepage": "https://www.fastly.com",
"main": "index.js",
Expand Down

0 comments on commit 9efa751

Please sign in to comment.