Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: shared context directory #101

Merged
merged 1 commit into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pkgmgr/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ type Config struct {
BinDir string
CacheDir string
ConfigDir string
ContextDir string
DataDir string
Logger *slog.Logger
Template *Template
Expand Down
12 changes: 10 additions & 2 deletions pkgmgr/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ func (p Package) install(cfg Config, context string, opts map[string]bool) (stri
cfg.CacheDir,
pkgName,
)
pkgContextDir := filepath.Join(
cfg.DataDir,
context,
)
pkgDataDir := filepath.Join(
cfg.DataDir,
pkgName,
Expand All @@ -108,8 +112,9 @@ func (p Package) install(cfg Config, context string, opts map[string]bool) (stri
"Options": opts,
},
"Paths": map[string]string{
"CacheDir": pkgCacheDir,
"DataDir": pkgDataDir,
"CacheDir": pkgCacheDir,
"ContextDir": pkgContextDir,
"DataDir": pkgDataDir,
},
},
)
Expand All @@ -130,6 +135,9 @@ func (p Package) install(cfg Config, context string, opts map[string]bool) (stri
if err := os.MkdirAll(pkgCacheDir, fs.ModePerm); err != nil {
return "", err
}
if err := os.MkdirAll(pkgContextDir, fs.ModePerm); err != nil {
return "", err
}
if err := os.MkdirAll(pkgDataDir, fs.ModePerm); err != nil {
return "", err
}
Expand Down
4 changes: 2 additions & 2 deletions pkgmgr/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var RegistryPackages = []Package{
"CARDANO_NODE_SOCKET_PATH": "/ipc/node.socket",
},
Binds: []string{
"{{ .Paths.CacheDir }}/ipc:/ipc",
"{{ .Paths.ContextDir }}/node-ipc:/ipc",
"{{ .Paths.DataDir }}/data:/data",
},
Ports: []string{
Expand Down Expand Up @@ -107,7 +107,7 @@ docker run --rm -ti ghcr.io/blinklabs-io/mithril-client:0.7.0-1 $@
ContainerName: "ogmios",
Image: "cardanosolutions/ogmios:v6.1.0",
Binds: []string{
"{{ .Paths.CacheDir }}/ipc:/ipc",
"{{ .Paths.ContextDir }}/node-ipc:/ipc",
},
Ports: []string{
"1337",
Expand Down