Default to SQLite rather than Postgres & Redis (#72)

* Initial rough draft switch to sqlite.

* Rewrote cache implemenation.

* Provide typed tasks.

* Task cleanup.

* Use same db for tasks.

* Provide task queue registration and service container injection.

* Added optional delay to tasks. Pool buffers when encoding.

* Added tests for the task client and runner.

* Added handler examples for caching and tasks.

* Cleanup and documentation.

* Use make in workflow.

* Updated documentation.

* Updated documentation.
This commit is contained in:
Mike Stefanello 2024-06-22 10:34:26 -04:00 committed by GitHub
parent 5e9e502b42
commit a096abd195
29 changed files with 956 additions and 910 deletions

View file

@ -57,6 +57,7 @@ type (
App AppConfig
Cache CacheConfig
Database DatabaseConfig
Tasks TasksConfig
Mail MailConfig
}
@ -89,12 +90,8 @@ type (
// CacheConfig stores the cache configuration
CacheConfig struct {
Hostname string
Port uint16
Password string
Database int
TestDatabase int
Expiration struct {
Capacity int
Expiration struct {
StaticFile time.Duration
Page time.Duration
}
@ -102,12 +99,16 @@ type (
// DatabaseConfig stores the database configuration
DatabaseConfig struct {
Hostname string
Port uint16
User string
Password string
Database string
TestDatabase string
Driver string
Connection string
TestConnection string
}
// TasksConfig stores the tasks configuration
TasksConfig struct {
PollInterval time.Duration
MaxRetries int
Goroutines int
}
// MailConfig stores the mail configuration

View file

@ -21,22 +21,20 @@ app:
emailVerificationTokenExpiration: "12h"
cache:
hostname: "localhost"
port: 6379
password: ""
database: 0
testDatabase: 1
capacity: 100000
expiration:
staticFile: "4380h"
page: "24h"
database:
hostname: "localhost"
port: 5432
user: "admin"
password: "admin"
database: "app"
testDatabase: "app_test"
driver: "sqlite3"
connection: "dbs/main.db?_journal=WAL&_timeout=5000&_fk=true"
testConnection: ":memory:?_journal=WAL&_timeout=5000&_fk=true"
tasks:
pollInterval: "1s"
maxRetries: 10
goroutines: 1
mail:
hostname: "localhost"