Skip to content

Commit fe83fb6

Browse files
committed
Update doc
1 parent fa6839c commit fe83fb6

File tree

1 file changed

+27
-26
lines changed

1 file changed

+27
-26
lines changed

README.md

+27-26
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ The env package provides a variety of methods for managing environment variables
88

99
The main features of the env module include:
1010

11-
- setting environment variables from variables defined in an env-file;
12-
- converting (marshaling) a Go structure to environment variables;
13-
- extracting (unmarshaling) environment variables to a Go structure;
14-
- setting any variables to the environment;
15-
- deleting variables from the environment;
16-
- checking for the presence of a variable in the environment;
17-
- retrieving the value of a variable by key from the environment;
18-
- clearing the environment.
11+
- setting environment variables from variables defined in an env-file;
12+
- converting (marshaling) a Go structure to environment variables;
13+
- extracting (unmarshaling) environment variables to a Go structure;
14+
- setting any variables to the environment;
15+
- deleting variables from the environment;
16+
- checking for the presence of a variable in the environment;
17+
- retrieving the value of a variable by key from the environment;
18+
- clearing the environment.
1919

2020
In addition, additional methods for working with `.env` files and data exchange between environment variables and the Go structs are implemented.
2121

@@ -154,11 +154,12 @@ func main() {
154154

155155

156156
The environment variable must meet the following requirements:
157-
- use only symbols of the Latin alphabet;
158-
- use uppercase to declare a variable;
159-
- to separate the words characterizing the variable, use the underscore character `_`;
160-
- the name of the variable cannot begin with a number or other symbol other than the Latin alphabet;
161-
- the variable can be declared after the export command.
157+
158+
- use only symbols of the Latin alphabet;
159+
- use uppercase to declare a variable;
160+
- to separate the words characterizing the variable, use the underscore character `_`;
161+
- the name of the variable cannot begin with a number or other symbol other than the Latin alphabet;
162+
- the variable can be declared after the export command.
162163

163164
```shell
164165
# Bad variable names:
@@ -209,8 +210,8 @@ func main() {
209210
### Values
210211

211212
Rules for setting the value:
212-
- values are set after the `=` symbol;
213-
- if the value is a string that containing spaces, it must be enclosed in quotation marks.
213+
- values are set after the `=` symbol;
214+
- if the value is a string that containing spaces, it must be enclosed in quotation marks.
214215

215216
```shell
216217
USER=support # string without spaces
@@ -287,8 +288,8 @@ For example, let's load project `B` data.
287288

288289
Pay attention:
289290

290-
- in the data structure, we do not specify the prefix, only the name of the variable;
291-
- use the `Unmarshal` method by passing the value of the prefix to it as the first argument.
291+
- in the data structure, we do not specify the prefix, only the name of the variable;
292+
- use the `Unmarshal` method by passing the value of the prefix to it as the first argument.
292293

293294
```go
294295
...
@@ -422,10 +423,10 @@ import "github.com/goloop/env"
422423

423424
There are several ways of using this package.
424425

425-
- transfer variables from env-files to the environment;
426-
- transfer data from the environment into Go structures;
427-
- saving Go structure's fields to the environment.
428-
- saving Go structure's fields to the env files.
426+
- transfer variables from env-files to the environment;
427+
- transfer data from the environment into Go structures;
428+
- saving Go structure's fields to the environment;
429+
- saving Go structure's fields to the env files.
429430

430431
### Parsing env files
431432

@@ -436,10 +437,10 @@ To change the number of goroutines you need to use the `ParallelTasks` method.
436437

437438
There are several methods for parsing env files:
438439

439-
- `Load` loads new keys only;
440-
- `LoadSafe` loads new keys only and doesn't handles variables like `${var}` or `$var` - doesn't turn them into a finite value;
441-
- `Update` loads keys from the env-file into environment, update existing keys;
442-
- `UpdateSafe` loads keys from the env-file into environment, update existing keys, and doesn't handles variables like `${var}` or `$var` - doesn't turn them into a finite value.
440+
- `Load` loads new keys only;
441+
- `LoadSafe` loads new keys only and doesn't handles variables like `${var}` or `$var` - doesn't turn them into a finite value;
442+
- `Update` loads keys from the env-file into environment, update existing keys;
443+
- `UpdateSafe` loads keys from the env-file into environment, update existing keys, and doesn't handles variables like `${var}` or `$var` - doesn't turn them into a finite value.
443444

444445
The `Update` function works like the `source` command in UNIX-Like operating systems.
445446

@@ -578,7 +579,7 @@ func main() {
578579
)
579580
log.Fatal(http.ListenAndServe(config.Addr(), nil))
580581
// Output:
581-
// Server started on 0.0.0.0:0
582+
// Server started on 0.0.0.0:8080
582583
// Allowed hosts: [localhost 127.0.0.1]
583584
}
584585
```

0 commit comments

Comments
 (0)