mirror of
https://github.com/pomerium/pomerium.git
synced 2025-06-05 12:23:03 +02:00
fileutil: add directory helpers, atomic file writing (#5477)
This commit is contained in:
parent
b9fd926618
commit
fbd1f34110
7 changed files with 133 additions and 27 deletions
|
@ -6,6 +6,8 @@ import (
|
|||
"path/filepath"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
|
||||
"github.com/pomerium/pomerium/internal/fileutil"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -63,11 +65,7 @@ func getBootstrapConfigFileName() (string, error) {
|
|||
if filename := os.Getenv(BootstrapConfigFileName); filename != "" {
|
||||
return filename, nil
|
||||
}
|
||||
cacheDir, err := os.UserCacheDir()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
dir := filepath.Join(cacheDir, "pomerium")
|
||||
dir := fileutil.CacheDir()
|
||||
if err := os.MkdirAll(dir, 0o700); err != nil {
|
||||
return "", fmt.Errorf("error creating cache directory: %w", err)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue