From b41596cccac9721b509babd9245a754b8a8e34b0 Mon Sep 17 00:00:00 2001 From: AbegaM Date: Wed, 8 May 2024 12:44:35 +0300 Subject: [PATCH 1/3] 0.7.7 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index e9cb520..a87d337 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "soul-cli", - "version": "0.7.6", + "version": "0.7.7", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "soul-cli", - "version": "0.7.6", + "version": "0.7.7", "license": "MIT", "dependencies": { "bcrypt": "^5.1.1", diff --git a/package.json b/package.json index d0faa7f..82fd7fc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "soul-cli", - "version": "0.7.6", + "version": "0.7.7", "description": "A SQLite REST and Realtime server", "main": "src/server.js", "bin": { From 58057e57a2a621dd342397058b53b7271f9f4781 Mon Sep 17 00:00:00 2001 From: AbegaM Date: Wed, 8 May 2024 14:15:26 +0300 Subject: [PATCH 2/3] Add feature to pass env file path from the CLI --- README.md | 19 +++++++++++++++++-- src/cli.js | 6 ++++++ src/config/index.js | 2 +- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index fdc8fb8..e2d9cb5 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,7 @@ Options: -p, --port Port to listen on [number] -r, --rate-limit-enabled Enable rate limiting [boolean] -c, --cors CORS whitelist origins [string] + --env, --envpath Path to load .env file [string] -a, --auth Enable authentication and authorization [boolean] --iuu, --initialuserusername Initial user username [string] @@ -42,8 +43,8 @@ Options: --ts, --tokensecret Token Secret [string] --atet, --accesstokenexpirationtime Access Token Expiration Time (Default: 5H) [string] --rtet, --refreshtokenexpirationtime Refresh Token Expiration Time (Default: 1D) [string] - -S, --studio Start Soul Studio in parallel - --help Show help + -S, --studio Start Soul Studio in parallel + --help Show help ``` @@ -98,6 +99,20 @@ soul -d foobar.db updatesuperuser --id=1 --is_superuser=true // Upgrade the user soul -d foobar.db updatesuperuser --id=1 --is_superuser=false // Revoke the superuser role from the superuser with ID 1 ``` +### Passing Custom Path for .env File + +There might be cases where you want to pass a custom path for your `.env` file. For this, you can use the `--env` flag when running the `soul` command, providing the absolute file path of your `.env` file. + +```shell +soul -d foobar.db --env=/Users/Documents/Projects/React-Project/.env +``` + +NOTE: + +- You should pass an absolute file path of the .env file. +- Relative paths are not allowed. +- Don't forget to include the .env file in the specified path. + ## Documentation API documentation is available while the project is running at [http://localhost:8000/api/docs](http://localhost:8000/api/docs) diff --git a/src/cli.js b/src/cli.js index 6873bc8..d7a6a2a 100644 --- a/src/cli.js +++ b/src/cli.js @@ -46,6 +46,12 @@ if (process.env.NO_CLI !== 'true') { type: 'string', demandOption: false, }) + .options('env', { + alias: 'envpath', + describe: 'Environment variable file path to load', + type: 'string', + demandOption: false, + }) .options('a', { alias: 'auth', describe: 'Enable authentication and authorization', diff --git a/src/config/index.js b/src/config/index.js index 5538d3a..ba0599a 100644 --- a/src/config/index.js +++ b/src/config/index.js @@ -6,7 +6,7 @@ const { yargs } = require('../cli'); const { argv } = yargs; -dotenv.config({ path: path.join(__dirname, '../../.env') }); +dotenv.config({ path: argv.envpath || path.join(__dirname, '../../.env') }); const envVarsSchema = Joi.object() .keys({ From 1b1bc0ad1f7992c99ad8703754ca57fd30a016c7 Mon Sep 17 00:00:00 2001 From: AbegaM Date: Wed, 8 May 2024 14:15:39 +0300 Subject: [PATCH 3/3] 0.7.8 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index a87d337..59620c0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "soul-cli", - "version": "0.7.7", + "version": "0.7.8", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "soul-cli", - "version": "0.7.7", + "version": "0.7.8", "license": "MIT", "dependencies": { "bcrypt": "^5.1.1", diff --git a/package.json b/package.json index 82fd7fc..5ed7198 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "soul-cli", - "version": "0.7.7", + "version": "0.7.8", "description": "A SQLite REST and Realtime server", "main": "src/server.js", "bin": {