Skip to content

trolleksii/firestorekv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FirestoreKV

Small CLI tool to store/retrieve key/value pairs in GCP Firestore(in Datastore mode).

How to use it

Accessing the Firestore will require the Service Account with 'Cloud Datastore User' Role granted. Download the Service Account key file and store it as credentials.json.

export GOOGLE_APPLICATION_CREDENTIALS="credentials.json"
export GOOGLE_PROJECT_ID="my_project123"

There are 3 commands implemented: get, put, and clean.

Storing values

The syntax is following:

./firestorekv put <KIND> <KEY> <VALUE>

For example:

./firestorekv put numbers the_number 42

Retrieving values

The syntax is following:

./firestorekv get <KIND> <KEY>

For example:

./firestorekv get numbers the_number

Cleanup old key/value pairs

All key/value pairs get timestamp field during creation/update. This allows to cleanup old entities.

The syntax is following:

./firestorekv clean <TIMESTAMP>

For example:

week_ago=$(date --date="7 days ago" +%s)
./firestorekv clean passwords $week_ago

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages