code: func configFromJSON(cfg jsonconfig.Obj) (config, error) {
  	conf := config{
  		server:     cfg.OptionalString("host", "localhost"),
  		database:   cfg.RequiredString("database"),
  		collection: cfg.OptionalString("collection", "blobs"),
  		user:       cfg.OptionalString("user", ""),
  		password:   cfg.OptionalString("password", ""),
  	}
  	if err := cfg.Validate(); err != nil {
  		return config{}, err
  	}
  	return conf, nil
  }
docs: // ConfigFromJSON populates Config from cfg, and validates
  // cfg. It returns an error if cfg fails to validate.