mirror of
https://github.com/EvolutionAPI/evolution-audio-converter.git
synced 2025-07-13 15:14:50 -06:00
fix: env file only dev mode
This commit is contained in:
parent
82895f17c1
commit
28ae9c0f8c
@ -66,7 +66,7 @@ Isso define a porta onde o serviço será executado.
|
|||||||
Para rodar o serviço localmente, use o seguinte comando:
|
Para rodar o serviço localmente, use o seguinte comando:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
go run main.go
|
go run main.go -dev
|
||||||
```
|
```
|
||||||
|
|
||||||
O servidor estará disponível em `http://localhost:4040`.
|
O servidor estará disponível em `http://localhost:4040`.
|
||||||
|
14
main.go
14
main.go
@ -4,6 +4,7 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"errors"
|
"errors"
|
||||||
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
@ -30,9 +31,16 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
err := godotenv.Load()
|
devMode := flag.Bool("dev", false, "Rodar em modo de desenvolvimento")
|
||||||
if err != nil {
|
flag.Parse()
|
||||||
fmt.Println("Erro ao carregar o arquivo .env")
|
|
||||||
|
if *devMode {
|
||||||
|
err := godotenv.Load()
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println("Erro ao carregar o arquivo .env")
|
||||||
|
} else {
|
||||||
|
fmt.Println("Arquivo .env carregado com sucesso")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
apiKey = os.Getenv("API_KEY")
|
apiKey = os.Getenv("API_KEY")
|
||||||
|
Loading…
Reference in New Issue
Block a user