warehouse-server is a database to manage your warehouse.
Build the images and start the container.
Mount cover directory under /usr/src/app/uploads/cover
.
package main
import (
"log"
"github.com/abaldeweg/warehouse-server/blog/router"
)
func main() {
r := router.Routes()
log.Fatal(r.Run(":8080"))
}
import "github.com/abaldeweg/warehouse-server/framework/config"
config.LoadAppConfig(config.WithName("myconfig"), config.WithFormat("json"), config.WithPaths("./config", "."))
viper.SetDefault("CORS_ALLOW_ORIGIN", "http://127.0.0.1")
import "github.com/abaldeweg/warehouse-server/framework/apikey"
key = apikey.NewAPIKeys([]byte(`{"keys": [{"key": "test-key", "permissions": ["read"]}]}`))
key.IsValidAPIKey("key") // returns true or false
key.HasPermission("key", "permission") // returns true or false
import "github.com/abaldeweg/warehouse-server/framework/cors"
r := gin.Default()
r.Use(cors.SetDefaultCorsHeaders())
Var | Description |
---|---|
CORS_ALLOW_ORIGIN | Allowed origins |
package main
import "github.com/abaldeweg/warehouse-server/framework/storage"
s := storage.NewStorage("filesystem", "data/auth", "api_keys.json")
k, _ := s.Save()
k, _ := s.Load()
k, _ := s.Remove()
Var | Description |
---|---|
CORS_ALLOW_ORIGIN | Allowed origins |
API_CORE | API endpoint for the core |
AUTH_API_ME | Authentication API endpoint |
Var | Description | Default |
---|---|---|
DATABASE | Define which database to use (sqlite or mysql) | sqlite |
MYSQL_URL | Databse config string for MySQL | adm:pass@tcp(localhost:3306)/warehouse?charset=utf8mb4&parseTime=True&loc=Local |
SQLITE_NAME | Database name for SQLite (without file extension) | warehouse |
Mount auth volume to /usr/src/app/data/auth/
and data volume to /usr/src/app/data/content/
.
The routes needs the API-Key to contain the articles
permission.
Var | Description |
---|---|
CORS_ALLOW_ORIGIN | Allowed origins |
The module sets up a simple HTTP file server that serves files from the data
directory on port 8080.
Mount data volume to /usr/src/app/data/
.
The module processes logs.
Mount data volume to /usr/src/app/data/logs/
.
Var | Description |
---|---|
MONGODB_URI | MongoDB connection string |
Create a config file in /data/config/config.json
with the following contents and fit it to your needs.
{
"blocklist": ["/"]
}
The module returns log entries by request.
Mount data volumes to /usr/src/app/data/auth/
.
Var | Description |
---|---|
MONGODB_URI | MongoDB connection string |
Run make release TAG=1.0.0
.