mirror of
https://github.com/Dvorinka/excalidraw-full.git
synced 2026-06-05 06:32:56 +00:00
Add different data providers and improve docs
This adds support for switching between in-memory, local filesystem, s3 or sqlite.
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
package stores
|
||||
|
||||
import (
|
||||
"excalidraw-complete/core"
|
||||
"excalidraw-complete/stores/aws"
|
||||
"excalidraw-complete/stores/filesystem"
|
||||
"excalidraw-complete/stores/memory"
|
||||
"excalidraw-complete/stores/sqlite"
|
||||
"os"
|
||||
)
|
||||
|
||||
func GetStore() core.DocumentStore {
|
||||
storageType := os.Getenv("STORAGE_TYPE")
|
||||
var store core.DocumentStore
|
||||
|
||||
switch storageType {
|
||||
case "filesystem":
|
||||
basePath := os.Getenv("LOCAL_STORAGE_PATH")
|
||||
store = filesystem.NewDocumentStore(basePath)
|
||||
case "sqlite":
|
||||
dataSourceName := os.Getenv("DATA_SOURCE_NAME")
|
||||
store = sqlite.NewDocumentStore(dataSourceName)
|
||||
case "s3":
|
||||
bucketName := os.Getenv("S3_BUCKET_NAME")
|
||||
store = aws.NewDocumentStore(bucketName)
|
||||
default:
|
||||
store = memory.NewDocumentStore()
|
||||
}
|
||||
return store
|
||||
}
|
||||
Reference in New Issue
Block a user