summaryrefslogtreecommitdiff
path: root/internal/authentication/file_user_provider.go
diff options
context:
space:
mode:
authorJames Elliott <james-d-elliott@users.noreply.github.com>2021-12-02 00:14:15 +1100
committerGitHub <noreply@github.com>2021-12-02 00:14:15 +1100
commit7df242f1e3f7364e3e9007421263e445266e8f57 (patch)
tree3ef37d0e8e519938feb15cbab5343915fe93ae66 /internal/authentication/file_user_provider.go
parent8a12af97abfe6ee13abdc3082fcb5996dd9badeb (diff)
refactor: remove ioutil (#2635)
Was deprecated in 1.16 and has more performant options available.
Diffstat (limited to 'internal/authentication/file_user_provider.go')
-rw-r--r--internal/authentication/file_user_provider.go7
1 files changed, 3 insertions, 4 deletions
diff --git a/internal/authentication/file_user_provider.go b/internal/authentication/file_user_provider.go
index 548c19c7a..6ee607a74 100644
--- a/internal/authentication/file_user_provider.go
+++ b/internal/authentication/file_user_provider.go
@@ -3,7 +3,6 @@ package authentication
import (
_ "embed" // Embed users_database.template.yml.
"fmt"
- "io/ioutil"
"os"
"strings"
"sync"
@@ -107,7 +106,7 @@ func checkDatabase(path string) []error {
var cfg []byte
func generateDatabaseFromTemplate(path string) error {
- err := ioutil.WriteFile(path, cfg, 0600)
+ err := os.WriteFile(path, cfg, 0600)
if err != nil {
return fmt.Errorf("Unable to generate %v: %v", path, err)
}
@@ -116,7 +115,7 @@ func generateDatabaseFromTemplate(path string) error {
}
func readDatabase(path string) (*DatabaseModel, error) {
- content, err := ioutil.ReadFile(path)
+ content, err := os.ReadFile(path)
if err != nil {
return nil, fmt.Errorf("Unable to read database from file %s: %s", path, err)
}
@@ -200,7 +199,7 @@ func (p *FileUserProvider) UpdatePassword(username string, newPassword string) e
return err
}
- err = ioutil.WriteFile(p.configuration.Path, b, fileAuthenticationMode)
+ err = os.WriteFile(p.configuration.Path, b, fileAuthenticationMode)
p.lock.Unlock()
return err