3
0

Implement permission provisioning and watchers

Remove rule reset from roles cli command
Add generic "provision" command for each binary and (re)set perm. rules
Permission rules are now separated and part of AccessControl service

Facility for watchers was added.
This commit is contained in:
Denis Arh
2019-05-10 09:49:07 +02:00
parent f113439d23
commit 2a4054c9bc
20 changed files with 377 additions and 166 deletions

View File

@@ -50,11 +50,18 @@ func main() {
switch command {
case "help":
flag.PrintDefaults()
case "provision":
if err := compose.Provision(ctx); err != nil {
println("Failed to provision compose: ", err.Error())
os.Exit(1)
}
default:
// Checks subscription, will os.Exit(1) if there is an error
// Disabled for now, system service is the only one that validates subscription
// ctx = subscription.Monitor(ctx)
compose.StartWatchers(ctx)
if err := compose.StartRestAPI(ctx); err != nil {
log.Fatal("failed to start compose REST API", zap.Error(err))
}

View File

@@ -78,6 +78,20 @@ func main() {
switch command {
case "help":
flag.PrintDefaults()
case "provision":
if err := system.Provision(ctx); err != nil {
println("Failed to provision system: ", err.Error())
os.Exit(1)
}
if err := compose.Provision(ctx); err != nil {
println("Failed to provision compose: ", err.Error())
os.Exit(1)
}
if err := messaging.Provision(ctx); err != nil {
println("Failed to provision messaging: ", err.Error())
os.Exit(1)
}
default:
// Initialize configuration of our services
if err := system.Init(ctx); err != nil {
@@ -103,6 +117,10 @@ func main() {
go metrics.NewMonitor(flags.monitor.Interval)
}
system.StartWatchers(ctx)
compose.StartWatchers(ctx)
messaging.StartWatchers(ctx)
r := chi.NewRouter()
// logging, cors and such

View File

@@ -50,6 +50,12 @@ func main() {
switch command {
case "help":
flag.PrintDefaults()
case "provision":
if err := messaging.Provision(ctx); err != nil {
println("Failed to provision messagign: ", err.Error())
os.Exit(1)
}
default:
// Checks subscription, will os.Exit(1) if there is an error
// Disabled for now, system service is the only one that validates subscription

View File

@@ -46,6 +46,11 @@ func main() {
switch command {
case "help":
flag.PrintDefaults()
case "provision":
if err := system.Provision(ctx); err != nil {
println("Failed to provision system: ", err.Error())
os.Exit(1)
}
default:
// Checks subscription, will os.Exit(1) if there is an error
ctx = subscription.Monitor(ctx)