27 lines
579 B
Go
27 lines
579 B
Go
// SPDX-FileCopyrightText: 2021 The NGI Pointer Secure-Scuttlebutt Team of 2020/2021
|
|
//
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package repo
|
|
|
|
import "path/filepath"
|
|
|
|
type Interface interface {
|
|
GetPath(...string) string
|
|
}
|
|
|
|
var _ Interface = repo{}
|
|
|
|
// New creates a new repository value, it opens the keypair and database from basePath if it is already existing
|
|
func New(basePath string) Interface {
|
|
return repo{basePath: basePath}
|
|
}
|
|
|
|
type repo struct {
|
|
basePath string
|
|
}
|
|
|
|
func (r repo) GetPath(rel ...string) string {
|
|
return filepath.Join(append([]string{r.basePath}, rel...)...)
|
|
}
|