change default paths for oCIS services

This commit is contained in:
Willy Kloucek
2021-10-19 14:37:20 +02:00
parent 75a4015954
commit cddb334f80
54 changed files with 212 additions and 218 deletions
+3 -2
View File
@@ -68,8 +68,9 @@ type Log struct {
// Repo defines which storage implementation is to be used.
type Repo struct {
Disk Disk
CS3 CS3
Backend string
Disk Disk
CS3 CS3
}
// Disk is the local disk implementation of the storage.
+12 -2
View File
@@ -1,8 +1,11 @@
package flagset
import (
"path"
"github.com/owncloud/ocis/accounts/pkg/config"
accounts "github.com/owncloud/ocis/accounts/pkg/proto/v0"
"github.com/owncloud/ocis/ocis-pkg/config/defaults"
"github.com/owncloud/ocis/ocis-pkg/flags"
"github.com/urfave/cli/v2"
)
@@ -155,10 +158,17 @@ func ServerWithConfig(cfg *config.Config) []cli.Flag {
EnvVars: []string{"ACCOUNTS_JWT_SECRET", "OCIS_JWT_SECRET"},
Destination: &cfg.TokenManager.JWTSecret,
},
&cli.StringFlag{
Name: "storage-backend",
Value: flags.OverrideDefaultString(cfg.Repo.Disk.Path, "CS3"),
Usage: "Which backend to use to store accounts data (CS3 or disk)",
EnvVars: []string{"ACCOUNTS_STORAGE_BACKEND"},
Destination: &cfg.Repo.Backend,
},
&cli.StringFlag{
Name: "storage-disk-path",
Value: flags.OverrideDefaultString(cfg.Repo.Disk.Path, ""),
Usage: "Path on the local disk, e.g. /var/tmp/ocis/accounts",
Value: flags.OverrideDefaultString(cfg.Repo.Disk.Path, path.Join(defaults.BaseDataPath(), "accounts")),
Usage: "Path on the local disk to store accounts data when backend is set to disk",
EnvVars: []string{"ACCOUNTS_STORAGE_DISK_PATH"},
Destination: &cfg.Repo.Disk.Path,
},
@@ -392,7 +392,7 @@ func deleteGroup(t *testing.T, id string) (*empty.Empty, error) {
// createTmpDir creates a temporary dir for tests data.
func createTmpDir() string {
name, err := ioutil.TempDir("/var/tmp", "ocis-accounts-store-")
name, err := ioutil.TempDir("/tmp", "ocis-accounts-store-")
if err != nil {
panic(err)
}
@@ -23,7 +23,7 @@ import (
"go-micro.dev/v4/metadata"
)
const dataPath = "/var/tmp/ocis-accounts-tests"
const dataPath = "/tmp/ocis-accounts-tests"
var (
roleServiceMock settings.RoleService
+1 -1
View File
@@ -58,7 +58,7 @@ func New(opts ...Option) (s *Service, err error) {
}
r := oreg.GetRegistry()
if cfg.Repo.Disk.Path == "" {
if strings.ToLower(cfg.Repo.Backend) != "disk" {
if _, err := r.GetService("com.owncloud.storage.metadata"); err != nil {
logger.Error().Err(err).Msg("index: storage-metadata service not present")
return nil, err