An open API service indexing awesome lists of open source software.

https://github.com/robincsamuel/ghost-google-drive

Google drive storage for ghost
https://github.com/robincsamuel/ghost-google-drive

ghost ghost-google-drive google-drive google-drive-storage

Last synced: 6 months ago
JSON representation

Google drive storage for ghost

Awesome Lists containing this project

README

          

# Ghost Google Drive
[Google drive storage](https://github.com/robincsamuel/ghost-google-drive) for ghost allows you to store the contents on google drive. I believe its helpful if you are gonna host your ghost app on heroku.

Will work with version higher than `0.6.0` of Ghost!

### What's is new in 2.x
- Rewritten to add support for Ghost 2.x.

## Installation
### Via NPM

- cd into Ghost's `current` directory and install `ghost-google-drive` storage module

```
cd current
npm install ghost-google-drive
```
- cd back to the root directory and make the storage folder if it doesn't exist yet

```
mkdir content/adapters/storage
```
- Copy the module into the right location

```
cp -vR current/node_modules/ghost-google-drive content/adapters/storage/ghost-google-drive
```
- Install package dependencies

```
cd content/adapters/storage/ghost-google-drive
npm install
```

### Via Git

In order to replace the storage module, the basic requirements are:

- Clone this repo to `/content/adapters/storage`. Please create the directories if not there.

```
cd [path/to/ghost]/content/adapters/storage
git clone https://github.com/robincsamuel/ghost-google-drive.git
```
- Install dependencies

```
cd ghost-google-drive
npm install
```

## Configuration

Add the following to your environment configuration, `config.development.json` if development.

- authType: googleAuth
```js
"storage": {
"active": "ghost-google-drive",
"ghost-google-drive": {
"authType": "googleAuth",
"key": {
"private_key_id": "YOUR PRIVATE KEY ID",
"private_key": "YOUR PRIVATE KEY",
"client_email": "YOUR CLIENT EMAIL",
"client_id": "YOUR CLIENT ID"
},
"folderId": "xxxxx"
}
},

```
- authType: jwt **default**
```js
"storage": {
"active": "ghost-google-drive",
"ghost-google-drive": {
"authType": "jwt",
"key": {
"private_key_id": "YOUR PRIVATE KEY ID",
"private_key": "YOUR PRIVATE KEY",
"client_email": "YOUR CLIENT EMAIL",
"client_id": "YOUR CLIENT ID"
}
}
},

```
You just have to replace the key object with your json array generated by google console.

If you are not sure about how to get google ccredentials, please read below.

## Create OAuth credentials

- Login to [google console](https://code.google.com/apis/console)

- Create a new project from the top right dropdown
![new project](http://i.imgur.com/fitDSc9.png)

- Click on `Enable APIS and Services`
![enable_apis](http://i.imgur.com/sm9O48v.png)

- Search `Google Drive`
![enable_apis](http://i.imgur.com/vyHhaqu.png)

- Enable `Google Drive API`
![enable api](http://i.imgur.com/VoF3yLu.png)

- Click on the `Create Credentials` button.
![enable api](http://i.imgur.com/qHbcl0F.png)

- Add information for credentialing.
![enable api](http://i.imgur.com/WMY2mFt.png)

- You can skip the OAuth consent screen setup.
![enable api](http://i.imgur.com/3mRqIuq.png)

- From the credentials section, create a new `Service Account Key`
![enable api](http://i.imgur.com/PE0MMw7.png)

- Enter the account info, choose `JSON` for key type and download the file.
![enable api](http://i.imgur.com/QF0wSNn.png)

- You can copy the contents of json file to the config file (under `storage.ghost-google-drive.key`) as shown in the `Configuration` step.
![enable api](https://i.imgur.com/pPr69gn.png)

---
This part below is only for authType: `googleAuth`
- Create the folder in your personal Google Drive
![](https://imgur.com/zEBqjSw.png)
![](https://imgur.com/hGvp9U9.png)
- Invite the service email to this folder and set this account th editor
![](https://imgur.com/Stnh6JM.png)
- Copy the folder's web url to get the folder id and paste to `storage.ghost-google-drive.folderId`
![](https://imgur.com/TiUyFoG.png)

---

- Restart Ghost

## Managing Google Drive
If you've followed the steps above, you just created a service account. A service account can't be logged into like a normal Google Drive account. Fret not! [We've built a solution to help.](https://github.com/behoyh/google-drive-ui)

## License

Read [LICENSE](LICENSE)

Feel free to create an [issue](https://github.com/robincsamuel/ghost-google-drive/issues), in case of troubles!

Thanks to [Minwe](https://github.com/Minwe). I was following your package, even this readme!