// defaults applies defaults to the config.
350342
func (c *Config) defaults() {
	if c.BufferSize == 0 {
		c.BufferSize = 100
	}

	if c.Format == "" {
		c.Format = "logs-06-01-02"
	}
}
1020993
func (ic *IntegerConstraint) Default(v interface{}) *IntegerConstraint {
	ic.NumberConstraint.Default(v)
	return ic
}
597770
func (c *Config) defaults() {
	if c.BufferSize == 0 {
		c.BufferSize = 100
	}
	if c.Prefix == "" {
		c.Prefix = "logs"
	}
	if c.Hostname == "" {
		c.Hostname, _ = os.Hostname()
	}
}
968586
func (c *defaultsCommand) resetDefaults(client defaultsCommandAPI, ctx *cmd.Context) error {
	// ctx unused in this method.
	if err := c.verifyKnownKeys(client, c.resetKeys); err != nil {
		return errors.Trace(err)
	}
	return block.ProcessBlockedError(
		client.UnsetModelDefaults(
			c.cloudName, c.regionName, c.resetKeys...), block.BlockChange)

}
495496
func setDefaults(p *CreateMachineParams) {
	if p.findPath == nil {
		p.findPath = paths.DataDir
	}
	if p.runCmd == nil {
		p.runCmd = runAsLibvirt
	}
	if p.runCmdAsRoot == nil {
		p.runCmdAsRoot = run
	}
}
185388
func (o *Options) SetDefaults() {
	if o.CTags == "" {
		ctags, err := exec.LookPath("universal-ctags")
		if err == nil {
			o.CTags = ctags
		}
	}

	if o.CTags == "" {
		ctags, err := exec.LookPath("ctags-exuberant")
		if err == nil {
			o.CTags = ctags
		}
	}
	if o.Parallelism == 0 {
		o.Parallelism = 1
	}
	if o.SizeMax == 0 {
		o.SizeMax = 128 << 10
	}
	if o.ShardMax == 0 {
		o.ShardMax = 128 << 20
	}

	if o.RepositoryDescription.Name == "" && o.RepositoryDescription.URL != "" {
		parsed, _ := url.Parse(o.RepositoryDescription.URL)
		if parsed != nil {
			o.RepositoryDescription.Name = filepath.Join(parsed.Host, parsed.Path)
		}
	}
}
166310
func (c *HeadersConfig) ApplyDefaults() *HeadersConfig {
	if c.JaegerBaggageHeader == "" {
		c.JaegerBaggageHeader = JaegerBaggageHeader
	}
	if c.JaegerDebugHeader == "" {
		c.JaegerDebugHeader = JaegerDebugHeader
	}
	if c.TraceBaggageHeaderPrefix == "" {
		c.TraceBaggageHeaderPrefix = TraceBaggageHeaderPrefix
	}
	if c.TraceContextHeaderName == "" {
		c.TraceContextHeaderName = TraceContextHeaderName
	}
	return c
}
132689
func ApplyDefaults(cfg *Config) {
	// Get defaults for Cipher, Kex algorithms, and MAC algorithms from
	// golang.org/x/crypto/ssh default config.
	var sc ssh.Config
	sc.SetDefaults()

	// Remove insecure and (borderline insecure) cryptographic primitives from
	// default configuration. These can still be added back in file configuration by
	// users, but not supported by default by Teleport. See #1856 for more
	// details.
	kex := utils.RemoveFromSlice(sc.KeyExchanges,
		defaults.DiffieHellmanGroup1SHA1,
		defaults.DiffieHellmanGroup14SHA1)
	macs := utils.RemoveFromSlice(sc.MACs,
		defaults.HMACSHA1,
		defaults.HMACSHA196)

	hostname, err := os.Hostname()
	if err != nil {
		hostname = "localhost"
		log.Errorf("Failed to determine hostname: %v.", err)
	}

	// global defaults
	cfg.Hostname = hostname
	cfg.DataDir = defaults.DataDir
	cfg.Console = os.Stdout
	cfg.CipherSuites = utils.DefaultCipherSuites()
	cfg.Ciphers = sc.Ciphers
	cfg.KEXAlgorithms = kex
	cfg.MACAlgorithms = macs

	// defaults for the auth service:
	cfg.Auth.Enabled = true
	cfg.Auth.SSHAddr = *defaults.AuthListenAddr()
	cfg.Auth.StorageConfig.Type = dir.GetName()
	cfg.Auth.StorageConfig.Params = backend.Params{defaults.BackendPath: filepath.Join(cfg.DataDir, defaults.BackendDir)}
	cfg.Auth.StaticTokens = services.DefaultStaticTokens()
	cfg.Auth.ClusterConfig = services.DefaultClusterConfig()
	defaults.ConfigureLimiter(&cfg.Auth.Limiter)
	// set new style default auth preferences
	ap := &services.AuthPreferenceV2{}
	ap.CheckAndSetDefaults()
	cfg.Auth.Preference = ap
	cfg.Auth.LicenseFile = filepath.Join(cfg.DataDir, defaults.LicenseFile)

	// defaults for the SSH proxy service:
	cfg.Proxy.Enabled = true
	cfg.Proxy.SSHAddr = *defaults.ProxyListenAddr()
	cfg.Proxy.WebAddr = *defaults.ProxyWebListenAddr()
	cfg.Proxy.ReverseTunnelListenAddr = *defaults.ReverseTunnellListenAddr()
	defaults.ConfigureLimiter(&cfg.Proxy.Limiter)

	// defaults for the Kubernetes proxy service
	cfg.Proxy.Kube.Enabled = false
	cfg.Proxy.Kube.ListenAddr = *defaults.KubeProxyListenAddr()

	// defaults for the SSH service:
	cfg.SSH.Enabled = true
	cfg.SSH.Addr = *defaults.SSHServerListenAddr()
	cfg.SSH.Shell = defaults.DefaultShell
	defaults.ConfigureLimiter(&cfg.SSH.Limiter)
	cfg.SSH.PAM = &pam.Config{Enabled: false}
}
988459
func (s *StringRule) Default() ctypes.ConfigValue {
	if s.default_ != nil {
		return ctypes.ConfigValueStr{Value: *s.default_}
	}
	return nil
}
406135
func DefaultOptions() *Options {
	return &Options{
		Retry: func() retry.Iterator {
			return &retry.ExponentialBackoff{
				Limited: retry.Limited{
					Delay:   time.Second,
					Retries: 5,
				},
			}
		},
	}
}
578158
func (b *BoolRule) Default() ctypes.ConfigValue {
	if b.default_ != nil {
		return ctypes.ConfigValueBool{Value: *b.default_}
	}
	return nil
}
1069346
func (ec *EndpointConfig) defaults() {
	if ec.Timeout <= 0 {
		ec.Timeout = time.Second
	}

	if ec.Threshold <= 0 {
		ec.Threshold = 10
	}

	if ec.Backoff <= 0 {
		ec.Backoff = time.Second
	}

	if ec.Transport == nil {
		ec.Transport = http.DefaultTransport.(*http.Transport)
	}
}
794160
func Defaults(key []byte, fips bool) (Encrypter, Decrypter) {
	f := NewFernet(key)
	if fips {
		return f, f
	}
	n := NewNACLSecretbox(key)
	return n, NewMultiDecrypter(n, f)
}
441519
func applyConfigDefaults(config map[string]string) {
	b, err := strconv.ParseBool(config[confKey.sslEnabled])
	if err != nil {
		klog.Warning(log("failed to parse param sslEnabled, setting it to false"))
		b = false
	}
	config[confKey.sslEnabled] = strconv.FormatBool(b)
	config[confKey.storageMode] = defaultString(config[confKey.storageMode], "ThinProvisioned")
	config[confKey.fsType] = defaultString(config[confKey.fsType], "xfs")
	b, err = strconv.ParseBool(config[confKey.readOnly])
	if err != nil {
		klog.Warning(log("failed to parse param readOnly, setting it to false"))
		b = false
	}
	config[confKey.readOnly] = strconv.FormatBool(b)
}
881413
func DefaultConfig() Config {
	return Config{
		Left:        "{{",
		Right:       "}}",
		Layout:      "",
		Funcs:       make(map[string]interface{}, 0),
		LayoutFuncs: make(map[string]interface{}, 0),
	}
}
1266865
func (r *rbroker) defaults() {
	ConnectTimeout(30 * time.Second)(&r.opts)
	VirtualHost("/")(&r.opts)
}
1135376
func (cfg *Config) Defaults() error {
	// default destination
	if cfg.Dest == "" {
		cfg.Dest = "/"
	}

	// insert "/" at end of dest when it's not found
	if !strings.HasSuffix(cfg.Dest, "/") {
		cfg.Dest += "/"
	}

	// default file name
	if cfg.Output == "" {
		cfg.Output = "b0x.go"
	}

	// inserts .go at the end of file name
	if !strings.HasSuffix(cfg.Output, ".go") {
		cfg.Output += ".go"
	}

	// inserts an A before the output file's name so it can
	// run init() before b0xfile's
	if !cfg.NoPrefix && !strings.HasPrefix(cfg.Output, "a") {
		cfg.Output = "a" + cfg.Output
	}

	// default package
	if cfg.Pkg == "" {
		cfg.Pkg = "main"
	}

	if cfg.Compression == nil {
		cfg.Compression = &compression.Options{
			Compress: false,
			Method:   "DefaultCompression",
			Keep:     false,
		}
	}

	return nil
}