Add environment variables and encryptor package

This commit is contained in:
Archer Fox
2025-03-18 22:04:43 +03:00
parent 69be01a1db
commit e7b8eb5601
5 changed files with 48 additions and 9 deletions

View File

@@ -2,13 +2,14 @@ package main
import (
"fmt"
"os"
"password/account"
"password/encrypter"
"password/files"
"password/output"
"strings"
"github.com/fatih/color"
"github.com/joho/godotenv"
)
var menu = map[string]func(*account.VaultWithDb){
@@ -37,9 +38,12 @@ func menuCounter() func() {
func main() {
color.Blue("__Менеджер паролей__")
res := os.Getenv("PWD")
fmt.Println(res)
vault := account.NewVault(files.NewJsonDb("data.json"))
// Load env file
err := godotenv.Load()
if err != nil {
output.PrintError("Не удалось найти файл .env")
}
vault := account.NewVault(files.NewJsonDb("data.json"), *encrypter.NewEncrypter())
counter := menuCounter()
Menu:
for {