Skip to content

Commit

Permalink
change service start order
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanielc committed Jul 27, 2016
1 parent 4060d5d commit c063750
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 2 additions & 0 deletions auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ type Interface interface {
Authenticate(username, password string) (User, error)
User(username string) (User, error)
SubscriptionUser(token string) (User, error)
GrantSubscriptionAccess(token, db, rp string) error
RevokeSubscriptionAccess(token string) error
}

// ErrAuthenticate is returned when authentication fails.
Expand Down
6 changes: 2 additions & 4 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,13 @@ func New(c *Config, buildInfo BuildInfo, logService logging.Interface) (*Server,
s.appendDeadmanService()
s.appendSMTPService()
s.InitHTTPDService()
s.appendAuthService()
if err := s.appendInfluxDBService(); err != nil {
return nil, errors.Wrap(err, "influxdb service")
}
s.appendStorageService()
s.appendTaskStoreService()
s.appendReplayService()
s.appendAuthService()

// Append Alert integration services
s.appendOpsGenieService()
Expand Down Expand Up @@ -218,6 +218,7 @@ func (s *Server) appendInfluxDBService() error {
srv := influxdb.NewService(c, s.config.defaultInfluxDB, httpPort, s.config.Hostname, s.config.HTTP.AuthEnabled, l)
srv.PointsWriter = s.TaskMaster
srv.LogService = s.LogService
srv.AuthService = s.AuthService

s.InfluxDBService = srv
s.TaskMaster.InfluxDBService = srv
Expand Down Expand Up @@ -289,9 +290,6 @@ func (s *Server) appendAuthService() {

s.AuthService = srv
s.HTTPDService.Handler.AuthService = srv
if s.InfluxDBService != nil {
s.InfluxDBService.AuthService = srv
}
s.AppendService("auth", srv)
}

Expand Down
2 changes: 1 addition & 1 deletion services/influxdb/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ func (s *influxdb) generateRandomToken() (string, error) {
if _, err := io.ReadFull(rand.Reader, tokenBytes); err != nil {
return "", err
}
return base64.URLEncoding.EncodeToString(tokenBytes), nil
return base64.RawURLEncoding.EncodeToString(tokenBytes), nil
}

func (s *influxdb) createSub(cli client.Client, name, cluster, rp, mode string, destinations []string) (err error) {
Expand Down

0 comments on commit c063750

Please sign in to comment.