Skip to content

Commit 405fdee

Browse files
authored
Merge pull request #230 from Real-Dev-Squad/fix-readme
fix: readme
2 parents ad9c409 + 030979c commit 405fdee

File tree

1 file changed

+46
-14
lines changed

1 file changed

+46
-14
lines changed

README.md

Lines changed: 46 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,52 @@ You should have some things pre-installed :
3030
git clone https://github.com/Real-Dev-Squad/identity-service.git
3131
```
3232

33-
## Run
34-
### *How to add the service file credentials in the sample-env.json*
35-
- Remove all the spaces such that the whole _json_ that you copied is in a single line
36-
- Replace **\n** with **\\\\n** in your copied json
37-
- Replace **"** with **\\"** in your copied json
38-
### *Firestore setup before running the server locally*
39-
- Create an application on [FireStore](https://firebase.google.com/docs/firestore) and [generate a service file](https://cloud.google.com/iam/docs/creating-managing-service-account-keys).
40-
- Add the service file credentials in the sample-env.json file as a string.
41-
- Rename `sample-env.json` to `env.json`
42-
43-
### *Executing the script to run the server locally*
44-
45-
- Windows users need to download & install [Git bash](https://gitforwindows.org/) to execute the scirpt.
46-
- Mac/Linux users can run the script in your native terminal.
33+
# Setting Up the Environment for Your Local Server
34+
35+
## Firestore Setup
36+
37+
1. Create an application on [Firebase Firestore](https://firebase.google.com/docs/firestore)
38+
2. [Generate a service account key file](https://cloud.google.com/iam/docs/creating-managing-service-account-keys)
39+
40+
## Environment Configuration
41+
42+
1. Create an `env.json` file by copying the `sample-env.json` template
43+
2. Add your Firestore service credentials to the file
44+
45+
### Formatting Service Credentials
46+
When adding the service account JSON to your `env.json` file:
47+
- Convert the entire JSON to a single line string
48+
- Escape special characters:
49+
- Replace all newlines (`\n`) with escaped newlines (`\\n`)
50+
- Replace all double quotes (`"`) with escaped double quotes (`\"`)
51+
52+
### Example
53+
If your service account JSON looks like this:
54+
```json
55+
{
56+
"type": "service_account",
57+
"project_id": "your-project-id",
58+
"private_key_id": "key-id",
59+
"private_key": "-----BEGIN PRIVATE KEY-----\nkey-content\n-----END PRIVATE KEY-----\n",
60+
"client_email": "[email protected]"
61+
}
62+
```
63+
64+
It should be added to `env.json` as:
65+
```json
66+
{
67+
"FIRESTORE_CREDENTIALS": "{\"type\":\"service_account\",\"project_id\":\"your-project-id\",\"private_key_id\":\"key-id\",\"private_key\":\"-----BEGIN PRIVATE KEY-----\\nkey-content\\n-----END PRIVATE KEY-----\\n\",\"client_email\":\"[email protected]\"}"
68+
}
69+
```
70+
71+
## 3. Running the Server
72+
73+
After completing the above steps, you can now run the server locally with your configured environment.
74+
75+
### Executing the script to run the server locally
76+
77+
- Windows users need to download & install [Git bash](https://gitforwindows.org/) to execute the script.
78+
- Mac/Linux users can run the script in their native terminal.
4779

4880
```
4981
sh scripts/dev.sh

0 commit comments

Comments
 (0)