Skip to content

Commit

Permalink
gcp auth
Browse files Browse the repository at this point in the history
  • Loading branch information
Aarsh2001 committed Oct 4, 2023
1 parent f657192 commit 61554ae
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/auth/db_auth.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from pymongo import MongoClient
from bson import ObjectId

import json
import sys


def _write_auth_to_file(endpoint, obj_id):
client = MongoClient(endpoint)
db = client.gcp_oauth
collection = db.creds
object_id_to_find = ObjectId(obj_id)

creds = collection.find_one({"_id": object_id_to_find})

with open("/gcp_auth.json", "w") as f:
json.dump(creds, f, indent=4)


if __name__ == "__main__":
endpoint, obj_id = sys.argv[0], sys.argv[1]
_write_auth_to_file(endpoint, obj_id)
2 changes: 2 additions & 0 deletions .github/auth/gcp_auth.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash

0 comments on commit 61554ae

Please sign in to comment.