Skip to content

Commit

Permalink
create token dir (#120)
Browse files Browse the repository at this point in the history
Signed-off-by: wfan <wfan@lycorp.co.jp>
  • Loading branch information
WindzCUHK committed Apr 15, 2024
1 parent 84d9ab4 commit a7e7cee
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/token/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"context"
"fmt"
"net/http"
"os"
"path/filepath"
"runtime/metrics"
"sync"
Expand Down Expand Up @@ -440,6 +441,11 @@ func (d *tokenService) writeFiles() error {
return nil
}

// Create the directory before saving tokens
if err := os.MkdirAll(d.tokenDir, 0755); err != nil {
return fmt.Errorf("unable to create directory for tokens: %w", err)
}

w := util.NewWriter()

err := d.accessTokenCache.Range(func(k CacheKey, t Token) error {
Expand Down

0 comments on commit a7e7cee

Please sign in to comment.