mirror of
https://github.com/sysadminsmedia/homebox.git
synced 2025-12-21 13:23:14 +01:00
add _time_format=sqlite parameter to SQLite URLs (#430)
This commit is contained in:
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@@ -23,7 +23,7 @@
|
|||||||
"HBOX_LOG_LEVEL": "debug",
|
"HBOX_LOG_LEVEL": "debug",
|
||||||
"HBOX_DEBUG_ENABLED": "true",
|
"HBOX_DEBUG_ENABLED": "true",
|
||||||
"HBOX_STORAGE_DATA": "${workspaceRoot}/backend/.data",
|
"HBOX_STORAGE_DATA": "${workspaceRoot}/backend/.data",
|
||||||
"HBOX_STORAGE_SQLITE_URL": "${workspaceRoot}/backend/.data/homebox.db?_fk=1"
|
"HBOX_STORAGE_SQLITE_URL": "${workspaceRoot}/backend/.data/homebox.db?_fk=1&_time_format=sqlite"
|
||||||
},
|
},
|
||||||
"console": "integratedTerminal",
|
"console": "integratedTerminal",
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build \
|
|||||||
FROM --platform=$TARGETPLATFORM alpine:latest
|
FROM --platform=$TARGETPLATFORM alpine:latest
|
||||||
ENV HBOX_MODE=production
|
ENV HBOX_MODE=production
|
||||||
ENV HBOX_STORAGE_DATA=/data/
|
ENV HBOX_STORAGE_DATA=/data/
|
||||||
ENV HBOX_STORAGE_SQLITE_URL=/data/homebox.db?_pragma=busy_timeout=2000&_pragma=journal_mode=WAL&_fk=1
|
ENV HBOX_STORAGE_SQLITE_URL=/data/homebox.db?_pragma=busy_timeout=2000&_pragma=journal_mode=WAL&_fk=1&_time_format=sqlite
|
||||||
|
|
||||||
# Install necessary runtime dependencies
|
# Install necessary runtime dependencies
|
||||||
RUN apk --no-cache add ca-certificates wget
|
RUN apk --no-cache add ca-certificates wget
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ FROM gcr.io/distroless/static:latest
|
|||||||
|
|
||||||
ENV HBOX_MODE=production
|
ENV HBOX_MODE=production
|
||||||
ENV HBOX_STORAGE_DATA=/data/
|
ENV HBOX_STORAGE_DATA=/data/
|
||||||
ENV HBOX_STORAGE_SQLITE_URL=/data/homebox.db?_fk=1
|
ENV HBOX_STORAGE_SQLITE_URL=/data/homebox.db?_fk=1&_time_format=sqlite
|
||||||
|
|
||||||
# Copy the binary and data directory, change ownership
|
# Copy the binary and data directory, change ownership
|
||||||
COPY --from=builder --chown=nonroot /go/bin/api /app
|
COPY --from=builder --chown=nonroot /go/bin/api /app
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ version: "3"
|
|||||||
|
|
||||||
env:
|
env:
|
||||||
HBOX_LOG_LEVEL: debug
|
HBOX_LOG_LEVEL: debug
|
||||||
HBOX_STORAGE_SQLITE_URL: .data/homebox.db?_pragma=busy_timeout=1000&_pragma=journal_mode=WAL&_fk=1
|
HBOX_STORAGE_SQLITE_URL: .data/homebox.db?_pragma=busy_timeout=1000&_pragma=journal_mode=WAL&_fk=1&_time_format=sqlite
|
||||||
HBOX_OPTIONS_ALLOW_REGISTRATION: true
|
HBOX_OPTIONS_ALLOW_REGISTRATION: true
|
||||||
UNSAFE_DISABLE_PASSWORD_PROJECTION: "yes_i_am_sure"
|
UNSAFE_DISABLE_PASSWORD_PROJECTION: "yes_i_am_sure"
|
||||||
tasks:
|
tasks:
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Generate migrations using Atlas support for MySQL (note the Ent dialect option passed above).
|
// Generate migrations using Atlas support for MySQL (note the Ent dialect option passed above).
|
||||||
err = migrate.NamedDiff(ctx, "sqlite://.data/homebox.migration.db?_fk=1", os.Args[1], opts...)
|
err = migrate.NamedDiff(ctx, "sqlite://.data/homebox.migration.db?_fk=1&_time_format=sqlite", os.Args[1], opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("failed generating migration file: %v", err)
|
log.Fatalf("failed generating migration file: %v", err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ func bootstrap() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func MainNoExit(m *testing.M) int {
|
func MainNoExit(m *testing.M) int {
|
||||||
client, err := ent.Open("sqlite3", "file:ent?mode=memory&cache=shared&_fk=1")
|
client, err := ent.Open("sqlite3", "file:ent?mode=memory&cache=shared&_fk=1&_time_format=sqlite")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("failed opening connection to sqlite: %v", err)
|
log.Fatalf("failed opening connection to sqlite: %v", err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ func bootstrap() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func MainNoExit(m *testing.M) int {
|
func MainNoExit(m *testing.M) int {
|
||||||
client, err := ent.Open("sqlite3", "file:ent?mode=memory&cache=shared&_fk=1")
|
client, err := ent.Open("sqlite3", "file:ent?mode=memory&cache=shared&_fk=1&_time_format=sqlite")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("failed opening connection to sqlite: %v", err)
|
log.Fatalf("failed opening connection to sqlite: %v", err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,5 +7,5 @@ const (
|
|||||||
type Storage struct {
|
type Storage struct {
|
||||||
// Data is the path to the root directory
|
// Data is the path to the root directory
|
||||||
Data string `yaml:"data" conf:"default:./.data"`
|
Data string `yaml:"data" conf:"default:./.data"`
|
||||||
SqliteURL string `yaml:"sqlite-url" conf:"default:./.data/homebox.db?_pragma=busy_timeout=999&_pragma=journal_mode=WAL&_fk=1"`
|
SqliteURL string `yaml:"sqlite-url" conf:"default:./.data/homebox.db?_pragma=busy_timeout=999&_pragma=journal_mode=WAL&_fk=1&_time_format=sqlite"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,29 +2,30 @@
|
|||||||
|
|
||||||
## Env Variables & Configuration
|
## Env Variables & Configuration
|
||||||
|
|
||||||
| Variable | Default | Description |
|
| Variable | Default | Description |
|
||||||
| ------------------------------------ | ---------------------- | ---------------------------------------------------------------------------------- |
|
|--------------------------------------|--------------------------------------------|----------------------------------------------------------------------------------------|
|
||||||
| HBOX_MODE | `production` | application mode used for runtime behavior can be one of: `development`, `production` |
|
| HBOX_MODE | `production` | application mode used for runtime behavior can be one of: `development`, `production` |
|
||||||
| HBOX_WEB_PORT | 7745 | port to run the web server on, if you're using docker do not change this |
|
| HBOX_WEB_PORT | 7745 | port to run the web server on, if you're using docker do not change this |
|
||||||
| HBOX_WEB_HOST | | host to run the web server on, if you're using docker do not change this |
|
| HBOX_WEB_HOST | | host to run the web server on, if you're using docker do not change this |
|
||||||
| HBOX_OPTIONS_ALLOW_REGISTRATION | true | allow users to register themselves |
|
| HBOX_OPTIONS_ALLOW_REGISTRATION | true | allow users to register themselves |
|
||||||
| HBOX_OPTIONS_AUTO_INCREMENT_ASSET_ID | true | auto-increments the asset_id field for new items |
|
| HBOX_OPTIONS_AUTO_INCREMENT_ASSET_ID | true | auto-increments the asset_id field for new items |
|
||||||
| HBOX_OPTIONS_CURRENCY_CONFIG | | json configuration file containing additional currencie |
|
| HBOX_OPTIONS_CURRENCY_CONFIG | | json configuration file containing additional currencie |
|
||||||
| HBOX_WEB_MAX_FILE_UPLOAD | 10 | maximum file upload size supported in MB |
|
| HBOX_WEB_MAX_FILE_UPLOAD | 10 | maximum file upload size supported in MB |
|
||||||
| HBOX_WEB_READ_TIMEOUT | 10s | Read timeout of HTTP sever |
|
| HBOX_WEB_READ_TIMEOUT | 10s | Read timeout of HTTP sever |
|
||||||
| HBOX_WEB_WRITE_TIMEOUT | 10s | Write timeout of HTTP server |
|
| HBOX_WEB_WRITE_TIMEOUT | 10s | Write timeout of HTTP server |
|
||||||
| HBOX_WEB_IDLE_TIMEOUT | 30s | Idle timeout of HTTP server |
|
| HBOX_WEB_IDLE_TIMEOUT | 30s | Idle timeout of HTTP server |
|
||||||
| HBOX_STORAGE_DATA | /data/ | path to the data directory, do not change this if you're using docker |
|
| HBOX_STORAGE_DATA | /data/ | path to the data directory, do not change this if you're using docker |
|
||||||
| HBOX_STORAGE_SQLITE_URL | /data/homebox.db?_fk=1 | sqlite database url, if you're using docker do not change this |
|
| HBOX_STORAGE_SQLITE_URL | /data/homebox.db?_fk=1&_time_format=sqlite | sqlite database url, if you're using docker do not change this |
|
||||||
| HBOX_LOG_LEVEL | `info` | log level to use, can be one of `trace`, `debug`, `info`, `warn`, `error`, `critical` |
|
| HBOX_LOG_LEVEL | `info` | log level to use, can be one of `trace`, `debug`, `info`, `warn`, `error`, `critical` |
|
||||||
| HBOX_LOG_FORMAT | `text` | log format to use, can be one of: `text`, `json` |
|
| HBOX_LOG_FORMAT | `text` | log format to use, can be one of: `text`, `json` |
|
||||||
| HBOX_MAILER_HOST | | email host to use, if not set no email provider will be used |
|
| HBOX_MAILER_HOST | | email host to use, if not set no email provider will be used |
|
||||||
| HBOX_MAILER_PORT | 587 | email port to use |
|
| HBOX_MAILER_PORT | 587 | email port to use |
|
||||||
| HBOX_MAILER_USERNAME | | email user to use |
|
| HBOX_MAILER_USERNAME | | email user to use |
|
||||||
| HBOX_MAILER_PASSWORD | | email password to use |
|
| HBOX_MAILER_PASSWORD | | email password to use |
|
||||||
| HBOX_MAILER_FROM | | email from address to use |
|
| HBOX_MAILER_FROM | | email from address to use |
|
||||||
| HBOX_SWAGGER_HOST | 7745 | swagger host to use, if not set swagger will be disabled |
|
| HBOX_SWAGGER_HOST | 7745 | swagger host to use, if not set swagger will be disabled |
|
||||||
| HBOX_SWAGGER_SCHEMA | `http` | swagger schema to use, can be one of: `http`, `https` |
|
| HBOX_SWAGGER_SCHEMA | `http` | swagger schema to use, can be one of: `http`, `https` |
|
||||||
|
|
||||||
|
|
||||||
::: tip "CLI Arguments"
|
::: tip "CLI Arguments"
|
||||||
If you're deploying without docker you can use command line arguments to configure the application. Run `homebox --help` for more information.
|
If you're deploying without docker you can use command line arguments to configure the application. Run `homebox --help` for more information.
|
||||||
@@ -38,7 +39,7 @@ OPTIONS
|
|||||||
--web-host/$HBOX_WEB_HOST <string>
|
--web-host/$HBOX_WEB_HOST <string>
|
||||||
--web-max-file-upload/$HBOX_WEB_MAX_FILE_UPLOAD <int> (default: 10)
|
--web-max-file-upload/$HBOX_WEB_MAX_FILE_UPLOAD <int> (default: 10)
|
||||||
--storage-data/$HBOX_STORAGE_DATA <string> (default: ./.data)
|
--storage-data/$HBOX_STORAGE_DATA <string> (default: ./.data)
|
||||||
--storage-sqlite-url/$HBOX_STORAGE_SQLITE_URL <string> (default: ./.data/homebox.db?_fk=1)
|
--storage-sqlite-url/$HBOX_STORAGE_SQLITE_URL <string> (default: ./.data/homebox.db?_fk=1&_time_format=sqlite)
|
||||||
--log-level/$HBOX_LOG_LEVEL <string> (default: info)
|
--log-level/$HBOX_LOG_LEVEL <string> (default: info)
|
||||||
--log-format/$HBOX_LOG_FORMAT <string> (default: text)
|
--log-format/$HBOX_LOG_FORMAT <string> (default: text)
|
||||||
--mailer-host/$HBOX_MAILER_HOST <string>
|
--mailer-host/$HBOX_MAILER_HOST <string>
|
||||||
|
|||||||
Reference in New Issue
Block a user