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

Use os.TempDir() for temporary directory in default path #158

Merged
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Flags:
-v, --version version for rest-server
```

By default the server persists backup data in `/tmp/restic`. To start the server with a custom persistence directory and with authentication disabled:
By default the server persists backup data in the OS temporary directory (`/tmp/restic` on Linux/BSD and others, in `%TEMP%\\restic` in Windows, etc). **If `rest-server` is launched using the default path, all backups will be lost**. To start the server with a custom persistence directory and with authentication disabled:

```sh
rest-server --path /user/home/backup --no-auth
Expand Down
8 changes: 8 additions & 0 deletions changelog/unreleased/pull-158
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Bugfix: Use platform-specific temporary directory in default path

Instead of using hardcoded value for temporary directory, rest-server now uses
Go standard library functions to retrieve the temporary directory path for the
current platform.

https://github.com/restic/rest-server/issues/157
https://github.com/restic/rest-server/pull/158
2 changes: 1 addition & 1 deletion cmd/rest-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ var cmdRoot = &cobra.Command{
}

var server = restserver.Server{
Path: "/tmp/restic",
Path: filepath.Join(os.TempDir(), "restic"),
Listen: ":8000",
}

Expand Down