VinceFilary / google-cloud-provider

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GoogleCloudProvider

Swift Vapor

This project aims to bring over as many Google Cloud Platform APIs as possible to Vapor projects.

Because the products and API's are so vast this will start slowly and over time add more API's as time goes on.

Quickstart

Before you begin note that this package only supports using Service accounts to authenticate to the various Google Cloud Platform APIs using OAuth2.

  1. Select or create a Cloud Platform project.

Go to the projects page

  1. Enable billing for your project.

Enable billing

  1. Enable the Google Cloud Storage API.

Enable the API

  1. Set up authentication with a service account so you can access the API from your local workstation.

To begin using GogleCloudProvider in your project you'll need to setup the initial configuration

In your Package.swift file, add the following

.package(url: "https://github.com/vapor-community/google-cloud-provider.git", from: "0.1.0")

And In Configure.swift or wherever you setup your configuration in Vapor

 import GoogleCloud
 
 let cloudConfig = GoogleCloudProviderConfig(project: "myprojectid-12345", credentialFile: "path to your service account json")
 services.register(cloudConfig)
 try services.register(GoogleCloudProvider())

Optionally, you can register an empty GoogleCloudProviderConfig() and configure the following environment variables:

export PROJECT_ID=myprojectid-12345
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/your/service-account.json

Additionally, you can copy and paste the contents of your Service Account JSON file as the value for the GOOGLE_APPLICATION_CREDENTIALS environment variable:

export GOOGLE_APPLICATION_CREDENTIALS=[Valid Pasted JSON]

Currently the following API's are implemented and you can follow the setup guides for each specific API to integrate with your Vapor project.

About

License:MIT License


Languages

Language:Swift 100.0%