1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-08 17:48:01 +00:00

Compare commits

...

3 Commits

Author SHA1 Message Date
nick-w-nick
e765d05871 Merge 295fe153ad into c8445c45a9 2025-03-05 15:28:05 -05:00
jbranchaud
c8445c45a9 Add Read Existing Dot Env File Into Env Vars as a Mise TIL 2025-03-05 13:19:08 -06:00
nick-w-nick
295fe153ad added mention of ES6 compatibility
Hello, I've added a small blockquote below the description to indicate that this method of accessing an indefinite number of function arguments has been superseded by the use of the spread operator via rest parameters for ES6+ compatibility.
2022-01-06 11:39:04 -05:00
3 changed files with 32 additions and 1 deletions

View File

@@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186).
_1608 TILs and counting..._
_1609 TILs and counting..._
See some of the other learning resources I work on:
- [Ruby Operator Lookup](https://www.visualmode.dev/ruby-operators)
@@ -691,6 +691,7 @@ If you've learned something here, support my efforts writing daily TILs by
### Mise
- [List The Files Being Loaded By Mise](mise/list-the-files-being-loaded-by-mise.md)
- [Read Existing Dot Env File Into Env Vars](mise/read-existing-dot-env-file-into-env-vars.md)
### MongoDB

View File

@@ -5,6 +5,8 @@ an array-like object with all of the arguments to the function. Even if not
all of the arguments are referenced in the function signature, they can
still be accessed via the `arguments` object.
> For ES6+ compatibility, the `spread` operator used via [rest parameters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters) is preferred over the `arugments` object when accessing an abritrary number of function arguments.
```javascript
function argTest(one) {
console.log(one);

View File

@@ -0,0 +1,28 @@
# Read Existing Dot Env File Into Env Vars
Just about any web app that I've worked on has had a `.env` file as a way of
configuring aspects of the app specific to that environment. These typically
are read into the environment with a language-specific
[dotenv](https://github.com/bkeepers/dotenv) tool.
Mise supports this convention. In addition to specifying individual non-secret
env vars, you can also instruct `mise` to read-in a `.env` file like so:
```toml
[env]
PORT=3344
_.file = ".env"
```
The `_.file` line tells `mise` that there is a file `.env` with key-value pairs
that it should read in. It can even handle `.env.json` and `.env.toml` file
formats.
To ensure that `mise` is picking up the values from the `.env` file, you can
run the following command and make sure they show up in the output:
```bash
$ mise env
```
[source](https://mise.jdx.dev/environments/secrets.html)