mirror of
https://github.com/caddyserver/caddy.git
synced 2025-01-28 04:45:56 +03:00
Ensure assets path exists before writing UUID file
This commit is contained in:
parent
93c5256318
commit
73273c5bf8
1 changed files with 6 additions and 1 deletions
|
@ -355,7 +355,12 @@ func initTelemetry() error {
|
||||||
|
|
||||||
newUUID := func() uuid.UUID {
|
newUUID := func() uuid.UUID {
|
||||||
id := uuid.New()
|
id := uuid.New()
|
||||||
err := ioutil.WriteFile(uuidFilename, []byte(id.String()), 0600) // human-readable as a string
|
err := os.MkdirAll(caddy.AssetsPath(), 0700)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("[ERROR] Persisting instance UUID: %v", err)
|
||||||
|
return id
|
||||||
|
}
|
||||||
|
err = ioutil.WriteFile(uuidFilename, []byte(id.String()), 0600) // human-readable as a string
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("[ERROR] Persisting instance UUID: %v", err)
|
log.Printf("[ERROR] Persisting instance UUID: %v", err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue