// NewConfigPaths returns the absolute paths to all of the different types of files
559297
func NewConfigPaths(baseCertDir string) *SecurityConfigPaths {
	return &SecurityConfigPaths{
		Node: CertPaths{
			Cert: filepath.Join(baseCertDir, nodeTLSCertFilename),
			Key:  filepath.Join(baseCertDir, nodeTLSKeyFilename)},
		RootCA: CertPaths{
			Cert: filepath.Join(baseCertDir, rootCACertFilename),
			Key:  filepath.Join(baseCertDir, rootCAKeyFilename)},
	}
}
1103217
func (c *DaemonConfig) GetNodeConfigPath() string {
	return filepath.Join(c.GetGlobalsDir(), common.NodeConfigFile)
}
759419
func NewPath(name string, moreNames ...string) *Path {
	r := &Path{name: name, parent: nil}
	for _, anotherName := range moreNames {
		r = &Path{name: anotherName, parent: r}
	}
	return r
}
1078138
func NewFiles(from []*any.Any) Files {
	files := map[string][]byte{}
	for _, f := range from {
		files[f.TypeUrl] = f.Value
	}
	return files
}
672790
func (g *Globber) filepaths(list []string, dir string, tree bool) (r []string) {
	var dirsep string
	if dir != "" {
		dirsep = dir + string(g.config.Separator)
		i := sort.SearchStrings(list, dirsep)
		if i >= len(list) {
			return
		}
		list = list[i:]
	}
	found := map[string]struct{}{}
	for _, path := range list {
		if dirsep != "" && !strings.HasPrefix(path, dirsep) {
			break
		}
		for j := len(dirsep); j < len(path); j++ {
			for j < len(path) && path[j] != g.config.Separator {
				j++
			}
			path := path[:j]
			if _, ok := found[path]; !ok {
				found[path] = struct{}{}
				r = append(r, path)
			}
			if !tree {
				break
			}
		}
	}
	return
}
1086217
func NewConfig(appName, fileName string) *Conf {
	if appName == "" {
		panic("appName.required")
	}

	if fileName == "" {
		fileName = "conf.json"
	}

	c := new(Conf)
	c.dirPath = fmt.Sprintf("%s/.%s", os.Getenv("HOME"), appName)
	c.fileName = fileName

	c.initConfig()

	return c
}
999895
func NewPaths(dataDir string, applicationTag names.ApplicationTag) Paths {
	join := filepath.Join
	baseDir := join(dataDir, "agents", applicationTag.String())
	stateDir := join(baseDir, "state")

	socket := func(name string, abstract bool) string {
		path := join(baseDir, name+".socket")
		if abstract {
			path = "@" + path
		}
		return path
	}

	toolsDir := tools.ToolsDir(dataDir, "")
	return Paths{
		ToolsDir: filepath.FromSlash(toolsDir),
		Runtime: RuntimePaths{
			JujuRunSocket:           socket("run", false),
			HookCommandServerSocket: socket("agent", true),
		},
		State: StatePaths{
			BaseDir:         baseDir,
			CharmDir:        join(baseDir, "charm"),
			BundlesDir:      join(stateDir, "bundles"),
			DeployerDir:     join(stateDir, "deployer"),
			RelationsDir:    join(stateDir, "relations"),
			OperationsFile:  join(stateDir, "operator"),
			MetricsSpoolDir: join(stateDir, "spool", "metrics"),
		},
	}
}
891059
func ReadConfigPaths(paths []string) (*Config, error) {
	result := new(Config)
	for _, path := range paths {
		f, err := os.Open(path)
		if err != nil {
			return nil, fmt.Errorf("Error reading '%s': %s", path, err)
		}

		fi, err := f.Stat()
		if err != nil {
			f.Close()
			return nil, fmt.Errorf("Error reading '%s': %s", path, err)
		}

		if !fi.IsDir() {
			config, err := DecodeConfig(f)
			f.Close()

			if err != nil {
				return nil, fmt.Errorf("Error decoding '%s': %s", path, err)
			}

			result = MergeConfig(result, config)
			continue
		}

		contents, err := f.Readdir(-1)
		f.Close()
		if err != nil {
			return nil, fmt.Errorf("Error reading '%s': %s", path, err)
		}

		// Sort the contents, ensures lexical order
		sort.Sort(dirEnts(contents))

		for _, fi := range contents {
			// Don't recursively read contents
			if fi.IsDir() {
				continue
			}

			// If it isn't a JSON file, ignore it
			if !strings.HasSuffix(fi.Name(), ".json") {
				continue
			}

			subpath := filepath.Join(path, fi.Name())
			f, err := os.Open(subpath)
			if err != nil {
				return nil, fmt.Errorf("Error reading '%s': %s", subpath, err)
			}

			config, err := DecodeConfig(f)
			f.Close()

			if err != nil {
				return nil, fmt.Errorf("Error decoding '%s': %s", subpath, err)
			}

			result = MergeConfig(result, config)
		}
	}

	return result, nil
}
89952
func NewJSONConfigParser() *jsonconfig.ConfigParser {
	var cp jsonconfig.ConfigParser
	dir, err := PerkeepConfigDir()
	if err != nil {
		log.Fatalf("NewJSONConfigParser error: %v", err)
	}
	cp.IncludeDirs = append([]string{dir}, filepath.SplitList(os.Getenv("CAMLI_INCLUDE_PATH"))...)
	return &cp
}
1306548
func newConfigFile(fileNames []string) *ConfigFile {
	c := new(ConfigFile)
	c.fileNames = fileNames
	c.data = make(map[string]map[string]string)
	c.keyList = make(map[string][]string)
	c.sectionComments = make(map[string]string)
	c.keyComments = make(map[string]map[string]string)
	c.BlockMode = true
	return c
}
148410
func NewConfig(attrs map[string]interface{}, schema environschema.Fields, defaults schema.Defaults) (*Config, error) {
	cfg := &Config{schema: schema, defaults: defaults}
	if err := cfg.setAttributes(attrs); err != nil {
		return nil, errors.Trace(err)
	}
	return cfg, nil
}
280001
func NewFilesystemBetweenPaths(readPath, writePath string) *Filesystem {
	return &Filesystem{
		path:     writePath,
		readPath: readPath,
	}
}
291289
func New(paths ...string) *Backend {
	backend := &Backend{}

	var files []string
	for _, p := range paths {
		if file, err := os.Open(p); err == nil {
			defer file.Close()
			if fileInfo, err := file.Stat(); err == nil {
				if fileInfo.IsDir() {
					yamlFiles, _ := filepath.Glob(filepath.Join(p, "*.yaml"))
					files = append(files, yamlFiles...)

					ymlFiles, _ := filepath.Glob(filepath.Join(p, "*.yml"))
					files = append(files, ymlFiles...)
				} else if fileInfo.Mode().IsRegular() {
					files = append(files, p)
				}
			}
		}
	}
	for _, file := range files {
		if content, err := ioutil.ReadFile(file); err == nil {
			backend.contents = append(backend.contents, content)
		}
	}
	return backend
}
32503
func NewGCSStore(gcs *storage.Client, bucket, cachepath string, pagesize int) (*GcsFS, error) {
	err := os.MkdirAll(path.Dir(cachepath), 0775)
	if err != nil {
		return nil, fmt.Errorf("unable to create path. path=%s err=%v", cachepath, err)
	}

	uid := uuid.NewUUID().String()
	uid = strings.Replace(uid, "-", "", -1)

	return &GcsFS{
		gcs:       gcs,
		bucket:    bucket,
		cachepath: cachepath,
		Id:        uid,
		PageSize:  pagesize,
	}, nil
}
513465
func (n *Network) OrdererConfigPath(o *Orderer) string {
	return filepath.Join(n.OrdererDir(o), "orderer.yaml")
}
604311
func New(configFilePath string) (*Registry, error) {
	c := Registry{
		v: viper.New(),
	}
	c.v.SetEnvPrefix("F8")
	c.v.AutomaticEnv()
	c.v.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))
	c.v.SetTypeByDefaultValue(true)
	c.setConfigDefaults()

	if configFilePath != "" {
		c.v.SetConfigType("yaml")
		c.v.SetConfigFile(configFilePath)
		err := c.v.ReadInConfig() // Find and read the config file
		if err != nil {           // Handle errors reading the config file
			return nil, errs.Errorf("Fatal error config file: %s \n", err)
		}
	}
	return &c, nil
}
706623
func NewConfig(pkgPath, newPkgPath string, rules ...string) (*ConfigV1, error) {
	c := &ConfigV1{
		Import: pkgPath,
	}
	if strings.HasPrefix(newPkgPath, ".") {
		c.Local = true
		c.Name = strings.TrimPrefix(newPkgPath, ".")
	} else {
		c.Name = newPkgPath
	}

	typeMap, err := ParseTypeMap(rules)
	if err != nil {
		return nil, err
	}
	c.TypeMap = typeMap

	return c, nil
}