flame/tools.go
func EnsureFirstUser(store *coal.Store, name, email, password string) error {
	// copy store
	s := store.Copy()
	defer s.Close()

	// check existence
	n, err := s.C(&User{}).Count()
	if err != nil {
		return err
	} else if n > 0 {
		return nil
	}

	// user is missing

	// create user
	user := coal.Init(&User{}).(*User)
	user.Name = name
	user.Email = email
	user.Password = password

	// set key and secret
	err = user.Validate()
	if err != nil {
		return err
	}

	// save user
	err = s.C(user).Insert(user)
	if err != nil {
		return err
	}

	return nil
}
func EnsureFirstUser(store *coal.Store, name, email, password string) error {
	// copy store
	s := store.Copy()
	defer s.Close()

	// check existence
	n, err := s.C(&User{}).Count()
	if err != nil {
		return err
	} else if n > 0 {
		return nil
	}

	// user is missing

	// create user
	user := coal.Init(&User{}).(*User)
	user.Name = name
	user.Email = email
	user.Password = password

	// set key and secret
	err = user.Validate()
	if err != nil {
		return err
	}

	// save user
	err = s.C(user).Insert(user)
	if err != nil {
		return err
	}

	return nil
}
// EnsureFirstUser ensures the existence of a first user if no other has been
// created.