// load loads configurations from a proto-defined Config
// If err is nil, then entries is guaranteed to be non-nil (though possibly empty).
174285
func load(config *tableaclpb.Config, newACL func([]string) (acl.ACL, error)) (entries aclEntries, err error) {
	if err := ValidateProto(config); err != nil {
		return nil, err
	}
	entries = aclEntries{}
	for _, group := range config.TableGroups {
		readers, err := newACL(group.Readers)
		if err != nil {
			return nil, err
		}
		writers, err := newACL(group.Writers)
		if err != nil {
			return nil, err
		}
		admins, err := newACL(group.Admins)
		if err != nil {
			return nil, err
		}
		for _, tableNameOrPrefix := range group.TableNamesOrPrefixes {
			entries = append(entries, aclEntry{
				tableNameOrPrefix: tableNameOrPrefix,
				groupName:         group.Name,
				acl: map[Role]acl.ACL{
					READER: readers,
					WRITER: writers,
					ADMIN:  admins,
				},
			})
		}
	}
	sort.Sort(entries)
	return entries, nil
}
644592
func Load(data []byte) (*clientcmdapi.Config, error) {
	config := clientcmdapi.NewConfig()
	// if there's no data in a file, return the default object instead of failing (DecodeInto reject empty input)
	if len(data) == 0 {
		return config, nil
	}

	if err := clientcmdlatest.Codec.DecodeInto(data, config); err != nil {
		return nil, err
	}
	return config, nil
}
1121633
func (c *Conf) Load(src interface{}) (err error) {
	b, err := ioutil.ReadFile(c.Path())
	if err != nil {
		return
	}

	err = json.Unmarshal(b, src)
	if err != nil {
		return
	}

	return
}
167044
func (c *Config) Load(path string) error {
	md, err := toml.DecodeFile(path, c)
	if err != nil {
		return err
	}
	if len(md.Undecoded()) > 0 {
		return errors.New("Unknown config keys in " + path)
	}

	if len(c.Incoming.AllowFrom) > 0 {
		subnets := make([]*net.IPNet, 0, len(c.Incoming.AllowFrom))
		for _, s := range c.Incoming.AllowFrom {
			if strings.IndexByte(s, '/') == -1 {
				s = s + "/32"
			}
			_, n, err := net.ParseCIDR(s)
			if err != nil {
				return errors.New("Invalid network or IP address: " + s)
			}
			subnets = append(subnets, n)
		}
		c.Incoming.allowSubnets = subnets
	}

	c.Outgoing.AllowSites = toLowerStrings(c.Outgoing.AllowSites)
	c.Outgoing.DenySites = toLowerStrings(c.Outgoing.DenySites)

	return nil
}
490498
func Load(paths ...string) (err error) {
	if len(paths) == 0 {
		paths = append(paths, ".env")
	}
	for _, path := range paths {
		err = loadFile(path, false)
		if err != nil {
			return
		}
	}
	return
}
1225080
func (d *database) Load(ctx context.Context, i interface{}) error {
	return ctxPool.GetSelect(ctx, d, d.e).Load(i)
}
1227146
func (sys *IAMSys) Load(objAPI ObjectLayer) error {
	if globalEtcdClient != nil {
		return sys.refreshEtcd()
	}
	return sys.refresh(objAPI)
}
154414
func (s *Settings) Load(props datastore.PropertyMap) error {
	if pdata, ok := props["Settings"]; ok {
		settings := pdata.Slice()
		if len(settings) != 1 {
			return fmt.Errorf("property `Settings` is a property slice")
		}
		settingsBytes, ok := settings[0].Value().([]byte)
		if !ok {
			return fmt.Errorf("expected byte array for property `Settings`")
		}
		if err := proto.Unmarshal(settingsBytes, &s.Settings); err != nil {
			return err
		}
		delete(props, "Settings")
	}
	return datastore.GetPLS(s).Load(props)
}
1057721
func (m *EventStore) Load(ctx context.Context, id uuid.UUID) ([]eh.Event, error) {
	if m.Err != nil {
		return nil, m.Err
	}
	m.Loaded = id
	m.Context = ctx
	return m.Events, nil
}
53761
func (c *Config) Load(file string) error {
	data, err := ioutil.ReadFile(file)

	if err != nil {
		log.Printf("Unable to ReadConfig File: %s -> %s", file, err.Error())
		return err
	}

	conf := Config{}
	err = yaml.Unmarshal(data, &conf)

	if err != nil {
		log.Printf("Unable to load Config File: %s -> %s", file, err.Error())
		return err
	}

	if err := mergo.MergeWithOverwrite(c, conf); err != nil {
		return err
	}

	c.Env = strings.TrimSpace(c.Env)

	env := strings.ToLower(c.Env)

	if !strings.Contains(env, "dev") && !strings.Contains(env, "development") && !strings.Contains(env, "debug") {
		c.Mode = 1
	}

	return nil
}
1358887
func (c *ConfigFile) Load() error {
	rw, err := NewConfigReadWriter(c.version)
	if err != nil {
		return err
	}
	filename := rw.Filename(c)
	if _, err := os.Stat(filename); err != nil {
		return err
	}
	file, err := os.Open(filename)
	if err != nil {
		return err
	}
	err = rw.LoadFromReader(file, c)
	if err != nil {
		return err
	}
	defer file.Close()
	return nil
}
400158
func (sp *StandardProvider) Load() (err error) {
	if !sp.Persistent() {
		return
	}

	var clearKey = true
	defer func() {
		if err != nil {
			if clearKey {
				sp.resetKey()
			}
			sp.resetCert()
		}
	}()

	sp.internal.keyPEM, err = ioutil.ReadFile(sp.Paths.KeyFile)
	if err != nil {
		return
	}

	sp.internal.priv, err = helpers.ParsePrivateKeyPEM(sp.internal.keyPEM)
	if err != nil {
		return
	}

	clearKey = false

	sp.internal.certPEM, err = ioutil.ReadFile(sp.Paths.CertFile)
	if err != nil {
		return ErrCertificateUnavailable
	}

	sp.internal.cert, err = helpers.ParseCertificatePEM(sp.internal.certPEM)
	if err != nil {
		err = errors.New("transport: invalid certificate")
		return
	}

	p, _ := pem.Decode(sp.internal.keyPEM)

	switch sp.internal.cert.PublicKey.(type) {
	case *rsa.PublicKey:
		if p.Type != "RSA PRIVATE KEY" {
			err = errors.New("transport: PEM type " + p.Type + " is invalid for an RSA key")
			return
		}
	case *ecdsa.PublicKey:
		if p.Type != "EC PRIVATE KEY" {
			err = errors.New("transport: PEM type " + p.Type + " is invalid for an ECDSA key")
			return
		}
	default:
		err = errors.New("transport: invalid public key type")
	}

	if err != nil {
		clearKey = true
		return
	}

	return nil
}
139699
func Load(file string) (Properties, error) {
	p := make(Properties)
	f, err := os.Open(file)
	if err != nil {
		return p, err
	}
	defer f.Close()
	if err := p.Load(f); err != nil {
		return p, err
	}
	return p, nil
}
510298
func (l *MemoryLoader) Load(name string) (Template, error) {
	v, ok := l.Templates[name]
	if !ok {
		return nil, os.ErrNotExist
	}
	return &stringTemplate{name, v}, nil
}
1356168
func Load(lca *CA, profiles *config.Signing) (err error) {
	lca.s, err = local.NewSignerFromFile(lca.CertFile, lca.KeyFile, profiles)
	return err
}
1269029
func (pc *ProtoClient) LoadInfo(info *ProtoBufferInfo) error {
	if info == nil {
		return errors.New("protobuffer information invalid")
	}
	pc.info = *info
	pc.ready = true
	return nil
}
1363443
func (l *yamlLoader) Load(out interface{}) error {
	var buf bytes.Buffer
	buf.ReadFrom(l.r)
	if err := yaml.Unmarshal(buf.Bytes(), out); err != nil {
		return err
	}
	return nil
}