// NewConfig initialises a new config for an Engine.
551637
func NewConfig() Config {
	return Config{
		RetentionInterval: toml.Duration(DefaultRetentionInterval),
		TSDB:              tsdb.NewConfig(),
		WAL:               tsm1.NewWALConfig(),
		Engine:            tsm1.NewConfig(),
		Index:             tsi1.NewConfig(),
	}
}
500847
func newConfig(appName string, pathToKeybase string, log Log, ignoreSnooze bool) (*config, error) {
	cfg := newDefaultConfig(appName, pathToKeybase, log, ignoreSnooze)
	err := cfg.load()
	return &cfg, err
}
572669
func New(cfg ...Config) *Typescript {
	c := DefaultConfig()
	if len(cfg) > 0 {
		c = cfg[0]
	}

	return &Typescript{Config: &c}
}
43324
func newValidConfig(cfg *config.Config) (*environConfig, error) {
	// Ensure that the provided config is valid.
	if err := config.Validate(cfg, nil); err != nil {
		return nil, errors.Trace(err)
	}

	// Apply the defaults and coerce/validate the custom config attrs.
	validated, err := cfg.ValidateUnknownAttrs(configFields, configDefaults)
	if err != nil {
		return nil, errors.Trace(err)
	}
	validCfg, err := cfg.Apply(validated)
	if err != nil {
		return nil, errors.Trace(err)
	}

	// Build the config.
	ecfg := newConfig(validCfg)

	// Do final validation.
	if err := ecfg.validate(); err != nil {
		return nil, errors.Trace(err)
	}

	return ecfg, nil
}
397692
func NewConfig(log logging.Logger) *Config {

	cfg := &Config{
		Logger:       log,
		Config:       cluster.NewConfig(),
		Partition:    -1,
		Partitioner:  sarama.NewHashPartitioner,
		RequiredAcks: AcksUnset,
	}

	return cfg
}
555865
func NewConfig() *Config {
	c := &Config{
		DataDir:             "~/.pilosa",
		Bind:                ":10101",
		MaxWritesPerRequest: 5000,

		// We default these Max File/Map counts very high. This is basically a
		// backwards compatibility thing where we don't want to cause different
		// behavior for those who had previously set their system limits high,
		// and weren't experiencing any bad behavior. Ideally you want these set
		// a bit below your system limits.
		MaxMapCount:  1000000,
		MaxFileCount: 1000000,
		TLS:          TLSConfig{},
	}

	// Cluster config.
	c.Cluster.Disabled = false
	c.Cluster.ReplicaN = 1
	c.Cluster.Hosts = []string{}
	c.Cluster.LongQueryTime = toml.Duration(time.Minute)

	// Gossip config.
	c.Gossip.Port = "14000"
	c.Gossip.StreamTimeout = toml.Duration(10 * time.Second)
	c.Gossip.SuspicionMult = 4
	c.Gossip.PushPullInterval = toml.Duration(30 * time.Second)
	c.Gossip.ProbeInterval = toml.Duration(1 * time.Second)
	c.Gossip.ProbeTimeout = toml.Duration(500 * time.Millisecond)
	c.Gossip.Interval = toml.Duration(200 * time.Millisecond)
	c.Gossip.Nodes = 3
	c.Gossip.ToTheDeadTime = toml.Duration(30 * time.Second)

	// AntiEntropy config.
	c.AntiEntropy.Interval = toml.Duration(10 * time.Minute)

	// Metric config.
	c.Metric.Service = "none"
	c.Metric.PollInterval = toml.Duration(0 * time.Minute)
	c.Metric.Diagnostics = true

	// Tracing config.
	c.Tracing.SamplerType = jaeger.SamplerTypeRemote
	c.Tracing.SamplerParam = 0.001

	c.Profile.BlockRate = 10000000 // 1 sample per 10 ms
	c.Profile.MutexFraction = 100  // 1% sampling

	return c
}
301916
func NewConfig(cfgs ...*viper.Viper) *Config {
	var cfg *viper.Viper
	if len(cfgs) > 0 {
		cfg = cfgs[0]
	} else {
		cfg = viper.New()
	}

	cfg.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))
	cfg.AutomaticEnv()
	c := &Config{config: cfg}
	c.fillDefaultValues()
	return c
}
1335613
func NewConfig(ctx types.Context) (gofig.Config, error) {

	pathConfig := context.MustPathConfig(ctx)

	config := registry.NewConfig()

	etcYML := path.Join(pathConfig.Etc, "config.yml")
	etcYAML := path.Join(pathConfig.Etc, "config.yaml")

	userHomeDir := gotil.HomeDir()
	usrYML := path.Join(userHomeDir, "config.yml")
	usrYAML := path.Join(userHomeDir, "config.yaml")

	if err := readConfigFile(config, etcYML); err != nil {
		return nil, err
	}
	if err := readConfigFile(config, etcYAML); err != nil {
		return nil, err
	}
	if err := readConfigFile(config, usrYML); err != nil {
		return nil, err
	}
	if err := readConfigFile(config, usrYAML); err != nil {
		return nil, err
	}

	types.BackCompat(config)

	return config, nil
}
207217
func NewFromConfig(config *factory.Config) *Scheduler {
	metrics.Register()
	return &Scheduler{
		config: config,
	}
}
197839
func NewConfig() *Config {
	return &Config{
		ID:           stringid.GenerateNonCryptoID(),
		StreamConfig: stream.NewConfig(),
		Started:      make(chan struct{}),
	}
}
154775
func NewConf() *Config {
	return &Config{
		DefaultLevel: "",
		Loggers:      []LoggerConfig{},
		Hooks:        make(map[string]HookConfig),
	}
}
28016
func NewConfig() Config {
	return Config{
		RetentionInterval:   toml.Duration(DefaultRetentionInterval),
		ValidateKeys:        DefaultValidateKeys,
		TraceLoggingEnabled: DefaultTraceLoggingEnabled,

		WAL:    tsm1.NewWALConfig(),
		Engine: tsm1.NewConfig(),
		Index:  tsi1.NewConfig(),
	}
}
32480
func New(cfg ...Config) *Engine {
	c := DefaultConfig()
	if len(cfg) > 0 {
		c = cfg[0]
	}

	// cuz mergo has a little bug on maps
	if c.Funcs == nil {
		c.Funcs = make(map[string]interface{}, 0)
	}

	return &Engine{Config: c}
}
624234
func New() *Config {
	return &Config{
		Path: configLocation(),
		Root: &StoreConfig{
			AskForMore:    false,
			AutoClip:      true,
			AutoImport:    true,
			AutoSync:      true,
			ClipTimeout:   45,
			Concurrency:   1,
			NoColor:       false,
			NoConfirm:     false,
			NoPager:       false,
			SafeContent:   false,
			UseSymbols:    false,
			Notifications: true,
		},
		Mounts: make(map[string]*StoreConfig),
	}
}
331404
func New(c Config) (*Foo, error) {
	//ensure proper initialization of Foo
	foo := &Foo{
		c:    c,
		bar:  42 + c.Zip,
		bazz: 21 + c.Zop,
	}

	return foo, nil
}
882046
func NewConfig(path string) (*Config, error) {
	c := newConfig()
	c.ConfigFile = path

	err := parseConfig(path, c, "", c.rawOpts)
	if err != nil {
		return nil, err
	}

	err = parseConfig(c.ConfigFile, c.Choria, "", c.rawOpts)
	if err != nil {
		return nil, err
	}

	c.parseAllDotCfg()

	err = normalize(c)
	if err != nil {
		return nil, err
	}

	return c, nil
}
730018
func InitWithConfig(configs ...Config) error {
	for _, config := range configs {
		l, err := NewLogger(config)
		if err != nil {
			return err
		}
		gl.loggers = append(gl.loggers, l)
	}
	return nil
}