Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create fronted cache if not found. #1469

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions proxied/fronted.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ func newFronted() fronted.Fronted {
log.Errorf("Unable to get user config dir: %v", err)
} else {
cacheFile = filepath.Join(dir, common.DefaultAppName, "fronted_cache.json")
if err := os.MkdirAll(filepath.Dir(cacheFile), 0755); err != nil {
log.Errorf("Failed to create directory: %v", err)
}
_, error := os.Stat(cacheFile)
if error != nil {
log.Debugf("Cache file not found at: %v", cacheFile)
_, err := os.Create(cacheFile)
log.Debugf("Cache file created at: %v", cacheFile)
if err != nil {
log.Errorf("Unable to create cache file: %v", err)
}
}
}
return fronted.NewFronted(cacheFile)
}
Expand Down
Loading