Repository: etcd-io/etcd
File: server/embed/config.go (Go)

Code before:
			ReusePort:    false,
			ReuseAddress: false,
		},

		TickMs:                     100,
		ElectionMs:                 1000,
		InitialElectionTickAdvance: true,

		ListenPeerUrls:      []url.URL{*lpurl},
		ListenClientUrls:    []url.URL{*lcurl},
		AdvertisePeerUrls:   []url.URL{*apurl},
		AdvertiseClientUrls: []url.URL{*acurl},

		ClusterState:        ClusterStateFlagNew,
		InitialClusterToken: "etcd-cluster",

		StrictReconfigCheck: DefaultStrictReconfigCheck,
		Metrics:             "basic",

		CORS:          map[string]struct{}{"*": {}},
		HostWhitelist: map[string]struct{}{"*": {}},

		AuthToken:              DefaultAuthToken,
		BcryptCost:             uint(bcrypt.DefaultCost),
		AuthTokenTTL:           300,
		SelfSignedCertValidity: 1,
		TlsMinVersion:          string(tlsutil.TLSVersion12),

		PreVote: true,

		loggerMu:              new(sync.RWMutex),
		logger:                nil,
		Logger:                "zap",
		LogFormat:             "json",
		LogOutputs:            []string{DefaultLogOutput},
		LogLevel:              logutil.DefaultLogLevel,
		EnableLogRotation:     false,
		LogRotationConfigJSON: DefaultLogRotationConfig,
		EnableGRPCGateway:     true,

		ExperimentalDowngradeCheckTime:            DefaultDowngradeCheckTime,
		ExperimentalMemoryMlock:                   false,
		ExperimentalStopGRPCServiceOnDefrag:       false,
		ExperimentalMaxLearners:                   membership.DefaultMaxLearners,
		ExperimentalTxnModeWriteWithSharedBuffer:  true,
		ExperimentalDistributedTracingAddress:     "localhost:4317",
		ExperimentalDistributedTracingServiceName: "etcd",

		CompactHashCheckTime: DefaultCompactHashCheckTime,
		// TODO: delete in v3.7
		ExperimentalCompactHashCheckTime: DefaultCompactHashCheckTime,

Review comment (suggestion):
We need to update the default value in `AddFlags`: change the 1 with `cfg.SelfSignedCertValidity`.  This comment applies other fields as well.

https://github.com/etcd-io/etcd/blob/c9045d650e6c1cb2e5361723adf3bb8c6ea22ee0/server/embed/config.go#L734

Code after:
func NewConfig() *Config {
	lpurl, _ := url.Parse(DefaultListenPeerURLs)
	apurl, _ := url.Parse(DefaultInitialAdvertisePeerURLs)
	lcurl, _ := url.Parse(DefaultListenClientURLs)
	acurl, _ := url.Parse(DefaultAdvertiseClientURLs)
	cfg := &Config{
		MaxSnapFiles: DefaultMaxSnapshots,
		MaxWalFiles:  DefaultMaxWALs,

		Name: DefaultName,

		SnapshotCount:          etcdserver.DefaultSnapshotCount,
		SnapshotCatchUpEntries: etcdserver.DefaultSnapshotCatchUpEntries,

		MaxTxnOps:            DefaultMaxTxnOps,
		MaxRequestBytes:      DefaultMaxRequestBytes,
		MaxConcurrentStreams: DefaultMaxConcurrentStreams,
		WarningApplyDuration: DefaultWarningApplyDuration,

		GRPCKeepAliveMinTime:  DefaultGRPCKeepAliveMinTime,
		GRPCKeepAliveInterval: DefaultGRPCKeepAliveInterval,
		GRPCKeepAliveTimeout:  DefaultGRPCKeepAliveTimeout,

		SocketOpts: transport.SocketOpts{
			ReusePort:    false,
			ReuseAddress: false,
		},

		TickMs:                     100,
		ElectionMs:                 1000,
		InitialElectionTickAdvance: true,

		ListenPeerUrls:      []url.URL{*lpurl},
		ListenClientUrls:    []url.URL{*lcurl},
		AdvertisePeerUrls:   []url.URL{*apurl},
		AdvertiseClientUrls: []url.URL{*acurl},

		ClusterState:        ClusterStateFlagNew,
		InitialClusterToken: "etcd-cluster",

		StrictReconfigCheck: DefaultStrictReconfigCheck,
		Metrics:             "basic",

		CORS:          map[string]struct{}{"*": {}},
		HostWhitelist: map[string]struct{}{"*": {}},

		AuthToken:              DefaultAuthToken,
		BcryptCost:             uint(bcrypt.DefaultCost),
		AuthTokenTTL:           300,
		SelfSignedCertValidity: DefaultSelfSignedCertValidity,
		TlsMinVersion:          DefaultTLSMinVersion,