Add environment variables and encryptor package
This commit is contained in:
25
go-demo-4/encrypter/encrypter.go
Normal file
25
go-demo-4/encrypter/encrypter.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package encrypter
|
||||
|
||||
import "os"
|
||||
|
||||
type Encrypter struct {
|
||||
Key string
|
||||
}
|
||||
|
||||
func NewEncrypter() *Encrypter {
|
||||
key := os.Getenv("KEY")
|
||||
if key == "" {
|
||||
panic("Не передан параметр KEY в переменные окружения")
|
||||
}
|
||||
return &Encrypter{
|
||||
Key: key,
|
||||
}
|
||||
}
|
||||
|
||||
func (enc *Encrypter) Encrypt(plainStr string) string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (enc *Encrypter) Decrypt(encryptedStr string) string {
|
||||
return ""
|
||||
}
|
||||
Reference in New Issue
Block a user