Skip to content
This repository has been archived by the owner on Oct 7, 2023. It is now read-only.

Commit

Permalink
mkdir tsstate when no dir given
Browse files Browse the repository at this point in the history
  • Loading branch information
markpash committed Jun 13, 2021
1 parent 2d28963 commit 296178f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,14 @@ func newTsNetServer() tsnet.Server {

stateDir := os.Getenv("TS_SIDECAR_STATEDIR")
if stateDir == "" {
stateDir = "./tsstate"
defaultDir := "./tsstate"
if _, err := os.Stat(defaultDir); os.IsNotExist(err) {
if err := os.Mkdir(defaultDir, 0755); err != nil {
panic("failed to create default state directory")
}
}

stateDir = defaultDir
}

return tsnet.Server{
Expand Down

0 comments on commit 296178f

Please sign in to comment.