From a47622b86ec708811ae2d568b6df73bba89af6d3 Mon Sep 17 00:00:00 2001 From: Vishwanath Martur <64204611+vishwamartur@users.noreply.github.com> Date: Tue, 5 Nov 2024 13:14:15 +0530 Subject: [PATCH] Fix environment variable not found for authKey Related to #1 Update the environment variable for `authKey` and add documentation for setting up the `.env` file. * **lib/env/env.dart** - Update the `@EnviedField` annotation to use `varName: 'AUTH_KEY'` instead of `varName: 'AUTH-KEY'`. * **.gitignore** - Remove the `.env` entry from the ignore list. * **.env** - Add a new `.env` file with the content `AUTH_KEY=your_auth_key_here`. * **README.md** - Add a section to document the need for a `.env` file and the required `AUTH_KEY` variable. - Include instructions for running the project after setting up the `.env` file. --- .env | 1 + .gitignore | 1 - README.md | 20 ++++++++++++++++++++ lib/env/env.dart | 2 +- 4 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 .env diff --git a/.env b/.env new file mode 100644 index 0000000..3d27816 --- /dev/null +++ b/.env @@ -0,0 +1 @@ +AUTH_KEY=your_auth_key_here diff --git a/.gitignore b/.gitignore index 853c336..48a58e4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ -*.env env.g.dart # Miscellaneous *.class diff --git a/README.md b/README.md index 3276d2f..8e43358 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,23 @@ # cms_flutter A mobile app for the app.100xDevs.com + +## Environment Setup + +To run this project, you need to set up a `.env` file in the root directory of the project. This file should contain the following environment variable: + +``` +AUTH_KEY=your_auth_key_here +``` + +Replace `your_auth_key_here` with the actual authentication key provided to you. + +## Running the Project + +After setting up the `.env` file, you can run the following command to build the project: + +``` +dart run build_runner build +``` + +This will generate the necessary files and allow you to run the project successfully. diff --git a/lib/env/env.dart b/lib/env/env.dart index d8194a0..9f1d661 100644 --- a/lib/env/env.dart +++ b/lib/env/env.dart @@ -4,6 +4,6 @@ part 'env.g.dart'; @Envied(path: '.env') final class Env { - @EnviedField(varName: 'AUTH-KEY', obfuscate: true) + @EnviedField(varName: 'AUTH_KEY', obfuscate: true) static final String authKey = _Env.authKey; }