Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go/cmd/vttablet/vttablet.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import (
var (
enforceTableACLConfig = flag.Bool("enforce-tableacl-config", false, "if this flag is true, vttablet will fail to start if a valid tableacl config does not exist")
tableACLConfig = flag.String("table-acl-config", "", "path to table access checker config file; send SIGHUP to reload this file")
tableACLConfigReloadInterval = flag.Duration("table-acl-config-reload-interval", 0, "Ticker to reload ACLs")
tableACLConfigReloadInterval = flag.Duration("table-acl-config-reload-interval", 0, "Ticker to reload ACLs. Duration flag, format e.g.: 30s. Default: do not reload")
tabletPath = flag.String("tablet-path", "", "tablet alias")
tabletConfig = flag.String("tablet_config", "", "YAML file config for tablet")

Expand Down
8 changes: 3 additions & 5 deletions go/vt/tableacl/tableacl.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,19 +109,17 @@ func (tacl *tableACL) init(configFile string, aclCB func()) error {
if configFile == "" {
return nil
}
log.Infof("Loading Table ACL from local file: %v", configFile)
data, err := ioutil.ReadFile(configFile)
if err != nil {
log.Infof("unable to read tableACL config file: %v", err)
log.Infof("unable to read tableACL config file: %v Error: %v", configFile, err)
return err
}
config := &tableaclpb.Config{}
if err := proto.Unmarshal(data, config); err != nil {
log.Infof("unable to parse tableACL config file as a protobuf file: %v, will try as json", err)
// try to parse tableacl as json file
if jsonErr := json2.Unmarshal(data, config); jsonErr != nil {
log.Infof("unable to parse tableACL config file as a json file: %v", jsonErr)
return fmt.Errorf("unable to unmarshal Table ACL data: %v", data)
log.Infof("unable to parse tableACL config file as a protobuf or json file. protobuf err: %v json err: %v", err, jsonErr)
return fmt.Errorf("unable to unmarshal Table ACL data: %s", data)
}
}
return tacl.Set(config)
Expand Down