2.0.9 • Published 4 years ago

env-from-sheet v2.0.9

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

Installation

With npm

npm install --save-dev env-from-sheet

Usage

import { SheetEnv } from 'env-from-sheet'

const client = new SheetEnv({
    installed:
    {
        client_id: 'your_client_id',
        client_secret: 'your_secret',
        redirect_uris: ['http://localhost']
    }
}, {
    projects: [
        {
            dest: 'path/to/.env',
            tab: 'google_sheet_tabname',
            column: 1 // 0 is key column
        }
    ],
    sheetId: 'your_sheet_id',
}, your_google_token)

Note that if you don't have google_token just leave it blank, terminal will ask you for authorization after you run sync()

await client.sync()

Example of token file

// This file is auto generated after sync()
// Please .gitignore for your security
{
    "access_token": "...",
    "expiry_date":  1573214579858,
    "refresh_token": "...",
    "scope":        "https://www.googleapis.com/auth/spreadsheets.readonly",
    "token_type":   "Bearer",
}

Google Sheet Structure

From this table we decalre column develop as {column:1} and uat as {column:2} and production as {column:3}
keydevelopuatproduction
PROJECT_IDexampleexampleexample
SECRET_KEYexampleexampleexample
{
    dest: 'path/to/.env',
    tab: 'google_sheet_tabname',
    column: 1 // 0 is key column
}
2.0.9

4 years ago

2.0.8

4 years ago

2.0.7

4 years ago

2.0.5

4 years ago

2.0.4

4 years ago

2.0.3

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago