-
Notifications
You must be signed in to change notification settings - Fork 189
/
Copy pathusers.go
84 lines (75 loc) · 2.85 KB
/
users.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
package flagset
import (
"github.com/micro/cli/v2"
"github.com/owncloud/ocis/ocis-pkg/flags"
"github.com/owncloud/ocis/storage/pkg/config"
)
// UsersWithConfig applies cfg to the root flagset
func UsersWithConfig(cfg *config.Config) []cli.Flag {
flags := []cli.Flag{
// debug ports are the odd ports
&cli.StringFlag{
Name: "debug-addr",
Value: flags.OverrideDefaultString(cfg.Reva.Users.DebugAddr, "0.0.0.0:9145"),
Usage: "Address to bind debug server",
EnvVars: []string{"STORAGE_SHARING_DEBUG_ADDR"},
Destination: &cfg.Reva.Users.DebugAddr,
},
// Services
// Userprovider
&cli.StringFlag{
Name: "network",
Value: flags.OverrideDefaultString(cfg.Reva.Users.GRPCNetwork, "tcp"),
Usage: "Network to use for the storage service, can be 'tcp', 'udp' or 'unix'",
EnvVars: []string{"STORAGE_USERPROVIDER_NETWORK"},
Destination: &cfg.Reva.Users.GRPCNetwork,
},
&cli.StringFlag{
Name: "addr",
Value: flags.OverrideDefaultString(cfg.Reva.Users.GRPCAddr, "0.0.0.0:9144"),
Usage: "Address to bind storage service",
EnvVars: []string{"STORAGE_USERPROVIDER_ADDR"},
Destination: &cfg.Reva.Users.GRPCAddr,
},
&cli.StringFlag{
Name: "endpoint",
Value: flags.OverrideDefaultString(cfg.Reva.Users.Endpoint, "localhost:9144"),
Usage: "URL to use for the storage service",
EnvVars: []string{"STORAGE_USERPROVIDER_ENDPOINT"},
Destination: &cfg.Reva.Users.Endpoint,
},
&cli.StringSliceFlag{
Name: "service",
Value: cli.NewStringSlice("userprovider"), // TODO preferences
Usage: "--service userprovider [--service otherservice]",
EnvVars: []string{"STORAGE_USERPROVIDER_SERVICES"},
},
&cli.StringFlag{
Name: "driver",
Value: flags.OverrideDefaultString(cfg.Reva.Users.Driver, "ldap"),
Usage: "user driver: 'demo', 'json', 'ldap', or 'rest'",
EnvVars: []string{"STORAGE_USERPROVIDER_DRIVER"},
Destination: &cfg.Reva.Users.Driver,
},
&cli.StringFlag{
Name: "json-config",
Value: flags.OverrideDefaultString(cfg.Reva.Users.JSON, ""),
Usage: "Path to users.json file",
EnvVars: []string{"STORAGE_USERPROVIDER_JSON"},
Destination: &cfg.Reva.Users.JSON,
},
&cli.IntFlag{
Name: "user-groups-cache-expiration",
Value: flags.OverrideDefaultInt(cfg.Reva.Users.UserGroupsCacheExpiration, 5),
Usage: "Time in minutes for redis cache expiration.",
EnvVars: []string{"STORAGE_USER_CACHE_EXPIRATION"},
Destination: &cfg.Reva.Users.UserGroupsCacheExpiration,
},
}
flags = append(flags, TracingWithConfig(cfg)...)
flags = append(flags, DebugWithConfig(cfg)...)
flags = append(flags, SecretWithConfig(cfg)...)
flags = append(flags, LDAPWithConfig(cfg)...)
flags = append(flags, RestWithConfig(cfg)...)
return flags
}