wisski-cloud-distillery/internal/dis/component/triplestore/triplestore.go
Tom 588cb7ebaa stack: Do not use templates for env files
This commit removes the templating logic for writing .env files.
Instead it simply writes a key-value directory directly to the destined
file.
2023-07-14 14:06:10 +02:00

55 lines
1.3 KiB
Go

package triplestore
import (
"embed"
"path/filepath"
"time"
"github.com/FAU-CDI/wisski-distillery/internal/dis/component"
)
type Triplestore struct {
component.Base
BaseURL string // upstream server url
PollInterval time.Duration // duration to wait for during wait
}
var (
_ component.Backupable = (*Triplestore)(nil)
_ component.Snapshotable = (*Triplestore)(nil)
_ component.Installable = (*Triplestore)(nil)
_ component.Provisionable = (*Triplestore)(nil)
)
func (ts *Triplestore) Path() string {
return filepath.Join(ts.Still.Config.Paths.Root, "core", "triplestore")
}
func (Triplestore) Context(parent component.InstallationContext) component.InstallationContext {
return parent
}
//go:embed all:triplestore
var resources embed.FS
func (ts *Triplestore) Stack() component.StackWithResources {
return component.MakeStack(ts, component.StackWithResources{
Resources: resources,
ContextPath: "triplestore",
CopyContextFiles: []string{"graphdb.zip"}, // TODO: Move into constant?
EnvContext: map[string]string{
"DOCKER_NETWORK_NAME": ts.Config.Docker.Network(),
},
MakeDirs: []string{
filepath.Join("data", "data"),
filepath.Join("data", "work"),
filepath.Join("data", "logs"),
filepath.Join("data", "import"),
},
})
}