Exemple #1
0
func (s *Service) regSrv(config vulcan.Config) {
	for {
		registry := vulcan.NewRegistry(config, s.options.EtcdNodes)
		entry, err := vulcan.NewEndpointWithID(s.options.ApplicationId,
			s.options.ApplicationId,
			s.options.Interface,
			s.options.Port)
		if err != nil {
			log.Errorf(err.Error())
		}
		log.Debugf(entry.String())

		if err := registry.RegisterBackend(entry); err != nil {
			log.Errorf(err.Error())
		}
		if err := registry.RegisterServer(entry); err != nil {
			log.Errorf(err.Error())
		}
		loc := vulcan.NewLocation(s.options.HostLimit,
			[]string{},
			s.options.RegisterPath,
			s.options.ApplicationId,
			[]middleware.Middleware{})
		if err := registry.RegisterFrontend(loc); err != nil {
			log.Errorf(err.Error())
		}
		log.Debugf("Syncing up Vulcan")
		time.Sleep(4000 * time.Millisecond)
	}
}
Exemple #2
0
func (n *ng) GetUserByEmail(email string) (MinimalUserRecord, error) {
	user := MinimalUserRecord{}
	session, _ := n.Database.CreateSession()
	defer session.Close()
	log.Debugf("===> Querying Database for email: " + email)
	if err := session.Query(`SELECT id,
    email,
    hashed_password,
    password_salt,
    encryption_keys,
    meta_storage,
    is_active
    FROM access_users
    WHERE email = ?
    LIMIT 1 ALLOW FILTERING`,
		email).Consistency(gocql.One).Scan(&user.Id,
		&user.Email,
		&user.HashedPassword,
		&user.PasswordSalt,
		&user.EncryptionKeys,
		&user.MetaStorage,
		&user.IsActive); err != nil {
		log.Errorf("===> Got a database error while querying for specific user")
		return MinimalUserRecord{}, err
	}
	return user, nil
}