mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-06 04:09:40 -06:00
add new os pkg on ocis-pkg
This commit is contained in:
@@ -1,13 +1,12 @@
|
||||
package flagset
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/micro/cli/v2"
|
||||
"github.com/owncloud/ocis/glauth/pkg/config"
|
||||
"github.com/owncloud/ocis/ocis-pkg/flags"
|
||||
pkgos "github.com/owncloud/ocis/ocis-pkg/os"
|
||||
)
|
||||
|
||||
// RootWithConfig applies cfg to the root flagset
|
||||
@@ -47,14 +46,6 @@ func HealthWithConfig(cfg *config.Config) []cli.Flag {
|
||||
}
|
||||
}
|
||||
|
||||
func mustUserConfigDir() string {
|
||||
dir, err := os.UserConfigDir()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return filepath.Join(dir, "ocis", "ldap")
|
||||
}
|
||||
|
||||
// ServerWithConfig applies cfg to the root flagset
|
||||
func ServerWithConfig(cfg *config.Config) []cli.Flag {
|
||||
return []cli.Flag{
|
||||
@@ -170,14 +161,14 @@ func ServerWithConfig(cfg *config.Config) []cli.Flag {
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "ldaps-cert",
|
||||
Value: flags.OverrideDefaultString(cfg.Ldaps.Cert, path.Join(mustUserConfigDir(), "ldap.crt")),
|
||||
Value: flags.OverrideDefaultString(cfg.Ldaps.Cert, path.Join(pkgos.MustUserConfigDir("ocis", "ldap"), "ldap.crt")),
|
||||
Usage: "path to ldaps certificate in PEM format",
|
||||
EnvVars: []string{"GLAUTH_LDAPS_CERT"},
|
||||
Destination: &cfg.Ldaps.Cert,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "ldaps-key",
|
||||
Value: flags.OverrideDefaultString(cfg.Ldaps.Key, path.Join(mustUserConfigDir(), "ldap.key")),
|
||||
Value: flags.OverrideDefaultString(cfg.Ldaps.Key, path.Join(pkgos.MustUserConfigDir("ocis", "ldap"), "ldap.key")),
|
||||
Usage: "path to ldaps key in PEM format",
|
||||
EnvVars: []string{"GLAUTH_LDAPS_KEY"},
|
||||
Destination: &cfg.Ldaps.Key,
|
||||
|
||||
Reference in New Issue
Block a user