Skip to content

Commit da1d262

Browse files
committed
Merge conflict
2 parents d600270 + 1e86071 commit da1d262

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ The plugin needs an api key of your site and its endpoint url. Optionally you ca
4040
To set these values you have two options:
4141
1. Use the default module options
4242
2. Add your options globally to the `nuxt.config.js`
43+
3. Use environment variables
4344

4445
#### Module Options
4546
When registering the module, don't register it as a string, but an array. The syntax should be:
@@ -66,6 +67,12 @@ ghost: {
6667
}
6768
```
6869

70+
#### Environment Variables
71+
If you don't want sensitive data in your code, or got multiple environments, you can use environment variables to configure this plugin.
72+
73+
`GHOST_API_KEY`: Sets the api key.
74+
`GHOST_API_URL`: Sets the api endpoint.
75+
6976
## Usage
7077
The usage is pretty straight forward. This package is just a wrapper for the official [JavaScript Content API](https://ghost.org/docs/api/v3/content/). Please check out their documentation to learn about [filtering](https://ghost.org/docs/api/v3/content/#parameters) or [pagination](https://ghost.org/docs/api/v3/content/#pagination). The `filter` parameter of the following methods is an `object` representation of the available query filters.
7178

lib/module.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ module.exports = function (_moduleOptions) {
1111
...moduleOptions
1212
}
1313

14+
if (!options.key) {
15+
options.key = process.env.GHOST_API_KEY
16+
}
17+
18+
if (!options.url) {
19+
options.url = process.env.GHOST_API_URL
20+
}
21+
1422
if (!options.key || !options.url) {
1523
throw new Error('[Ghost] Please provide your sites url and the api key.')
1624
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nuxtjs-ghost",
3-
"version": "1.0.4",
3+
"version": "1.1.0",
44
"description": "NuxtJS module to easily interact with the Ghost API",
55
"repository": "https://github.com/ditschedev/nuxtjs-ghost",
66
"license": "MIT",

0 commit comments

Comments
 (0)