update environment project for web & electron
This commit is contained in:
parent
edcccaaab9
commit
f0edcbeeea
2 changed files with 15 additions and 4 deletions
|
|
@ -30,11 +30,19 @@ We have some environment variables to control app behavior. The environment vari
|
|||
|
||||
> note: All the environment variables can access through `import.meta.env.{VARIABLE_NAME}`.
|
||||
|
||||
> note: In development mode, you can create a `.env.development.local` file in the root directory of the project to set environment variables.
|
||||
> note: In development, you can create a `.env.local` file in the root directory of the project to set environment variables.
|
||||
|
||||
## Environment Mode
|
||||
|
||||
In this Client project, we have two environment modes: `electron` and `web`. Business logic will be different in these two modes. you wrap the code in `if (import.meta.env.MODE === 'electron')` to run the code in electron mode. You can also use `if (import.meta.env.MODE === 'web')` to run the code in web mode.
|
||||
|
||||
The reason why we have two environment modes is that in electron we have to use native modules for example `deeplink` to handle login callback. But in web, we have to use `window.location.href` to handle login callback.
|
||||
|
||||
> In Development, the default if to run cmd `npm run dev` is will run in both electron and web mode. If you want to run in electron or web mode, you can run `npm run dev:electron` or `npm run dev:web`.
|
||||
|
||||
## Environment Variables List
|
||||
|
||||
In this section, we will list all the environment variables. That app will use the default value if you don't set the environment variables.
|
||||
In this section, we will list all the environment variables. That app will use in both environment mode the default value if you don't set the environment variables.
|
||||
|
||||
> dev: if you add new environment variables, please add it to this section.
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,9 @@
|
|||
"database": "${workspaceFolder:server}/data/database.db"
|
||||
}
|
||||
],
|
||||
"sqltools.useNodeRuntime": true
|
||||
"sqltools.useNodeRuntime": true,
|
||||
"cSpell.words": [
|
||||
"TAOBIN"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue