Skip to content
This repository was archived by the owner on Sep 13, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
GOOGLE_PROJECT_ID=
GOOGLE_APPLICATION_CREDENTIALS=./google-service-account.json
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,20 @@ In order to fireway be able to connect to firestore you need to set up the envir

Example:
```bash
export GOOGLE_APPLICATION_CREDENTIALS="path/to/firestore-service-account.json"
export GOOGLE_APPLICATION_CREDENTIALS="path/to/google-service-account.json"
```

### .env support

Alternatively, you can set upt `GOOGLE_PROJECT_ID` and `GOOGLE_APPLICATION_CREDENTIALS` vars on `.env` file.

Example:
```.env
GOOGLE_PROJECT_ID=project-id
GOOGLE_APPLICATION_CREDENTIALS="path/to/google-service-account.json"
```


## CLI

```bash
Expand Down Expand Up @@ -66,6 +77,7 @@ Examples
$ fireway migrate --forceWait
$ fireway --require="ts-node/register" migrate
```
PS: Alternatively to `--projectId` you can set up a `GOOGLE_PROJECT_ID` var on `.env` file.

## Migration file format

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"dependencies": {
"@google-cloud/firestore": "^5.0.2",
"callsites": "^3.1.0",
"dotenv": "^16.0.3",
"firebase-admin": "^10.1.0",
"md5": "^2.2.1",
"sade": "^1.6.1",
Expand All @@ -52,4 +53,4 @@
"@types/node": "^14.18.16",
"typescript": "^4.6.4"
}
}
}
2 changes: 1 addition & 1 deletion src/cli.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env node

require("dotenv").config();
const sade = require('sade');
const fireway = require('./index');
const pkg = require('../package.json');
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ async function trackAsync({log, file, forceWait}, fn) {
}
trackAsync[dontTrack] = true;

async function migrate({path: dir, projectId, storageBucket, dryrun, app, debug = false, require: req, forceWait = false} = {}) {
async function migrate({path: dir, projectId = process.env.GOOGLE_PROJECT_ID, storageBucket, dryrun, app, debug = false, require: req, forceWait = false} = {}) {
if (req) {
try {
require(req);
Expand Down
14 changes: 6 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2006,6 +2006,11 @@ dot-prop@^5.2.0:
dependencies:
is-obj "^2.0.0"

dotenv@^16.0.3:
version "16.0.3"
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.0.3.tgz#115aec42bac5053db3c456db30cc243a5a836a07"
integrity sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==

dotenv@^6.1.0:
version "6.2.0"
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-6.2.0.tgz#941c0410535d942c8becf28d3f357dbd9d476064"
Expand Down Expand Up @@ -4202,14 +4207,7 @@ node-emoji@^1.4.1:
dependencies:
lodash.toarray "^4.4.0"

node-fetch@2.6.7, node-fetch@^2.6.1:
version "2.6.7"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad"
integrity sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==
dependencies:
whatwg-url "^5.0.0"

node-fetch@^2.6.7:
node-fetch@2.6.7, node-fetch@^2.6.1, node-fetch@^2.6.7:
version "2.6.7"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad"
integrity sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==
Expand Down