mirror of
https://github.com/ddworken/hishtory.git
synced 2024-11-22 08:14:02 +01:00
Document that the server can use sqlite
This commit is contained in:
parent
4aacd8b5e2
commit
fd3d932e9d
@ -106,7 +106,11 @@ Download the latest binary from [Github Releases](https://github.com/ddworken/hi
|
||||
<summary>Self-Hosting</summary>
|
||||
By default, hiSHtory relies on a backend for syncing. All data is end-to-end encrypted, so the backend can't view your history.
|
||||
|
||||
But if you'd like to self-host the hishtory backend, you can! The backend is a simple go binary in `backend/server/server.go` that uses postgres to store data. Check out the [`docker-compose.yml`](https://github.com/ddworken/hishtory/blob/master/backend/server/docker-compose.yml) file for an example config to start a hiSHtory server and how to configure it.
|
||||
But if you'd like to self-host the hishtory backend, you can! The backend is a simple go binary in `backend/server/server.go`. It can either use SQLite or Postgres for persistence.
|
||||
|
||||
Check out the [`docker-compose.yml`](https://github.com/ddworken/hishtory/blob/master/backend/server/docker-compose.yml) file for an example config to start a hiSHtory server using postgres.
|
||||
|
||||
If you want to use a SQLite backend, you can do so by setting the `HISHTORY_SQLITE_DB` environment variable to point to a file. It will then create a SQLite DB at the given location.
|
||||
</details>
|
||||
|
||||
<details>
|
||||
|
@ -8,7 +8,6 @@ import (
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"os/user"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
@ -371,11 +370,7 @@ func wipeDbHandler(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func isTestEnvironment() bool {
|
||||
u, err := user.Current()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return os.Getenv("HISHTORY_TEST") != "" || u.Username == "david"
|
||||
return os.Getenv("HISHTORY_TEST") != ""
|
||||
}
|
||||
|
||||
func OpenDB() (*gorm.DB, error) {
|
||||
@ -394,7 +389,6 @@ func OpenDB() (*gorm.DB, error) {
|
||||
}
|
||||
|
||||
var sqliteDb string
|
||||
|
||||
if os.Getenv("HISHTORY_SQLITE_DB") != "" {
|
||||
sqliteDb = os.Getenv("HISHTORY_SQLITE_DB")
|
||||
}
|
||||
@ -411,7 +405,6 @@ func OpenDB() (*gorm.DB, error) {
|
||||
}
|
||||
db, err = gorm.Open(postgres.Open(postgresDb), &gorm.Config{})
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to connect to the DB: %v", err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user