Skip to content

Commit f5949a5

Browse files
committedOct 13, 2022
Encoding
1 parent 77a63cf commit f5949a5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed
 

‎storage.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package storagenomad
22

33
import (
44
"context"
5+
"encoding/base64"
56
"fmt"
67
"io/fs"
78
"os"
@@ -60,7 +61,7 @@ func (ns NomadStorage) Store(ctx context.Context, key string, value []byte) erro
6061
loggy("VALUE TO STORE: %s", string(value))
6162

6263
items := &nomad.VariableItems{
63-
"Value": string(value),
64+
"Value": base64.StdEncoding.EncodeToString(value),
6465
"Modified": time.Now().Format(time.RFC3339),
6566
}
6667

@@ -107,8 +108,7 @@ func (ns NomadStorage) Load(ctx context.Context, key string) ([]byte, error) {
107108
loggy("got items")
108109

109110
if val, ok := items["Value"]; ok {
110-
loggy("getting value")
111-
return []byte(val), nil
111+
return base64.StdEncoding.DecodeString(val)
112112
}
113113

114114
loggy("wat")

0 commit comments

Comments
 (0)