functional/rpcpb/etcd_config.go
func (e *Etcd) EmbedConfig() (cfg *embed.Config, err error) {
	var lcURLs types.URLs
	lcURLs, err = types.NewURLs(e.ListenClientURLs)
	if err != nil {
		return nil, err
	}
	var acURLs types.URLs
	acURLs, err = types.NewURLs(e.AdvertiseClientURLs)
	if err != nil {
		return nil, err
	}
	var lpURLs types.URLs
	lpURLs, err = types.NewURLs(e.ListenPeerURLs)
	if err != nil {
		return nil, err
	}
	var apURLs types.URLs
	apURLs, err = types.NewURLs(e.AdvertisePeerURLs)
	if err != nil {
		return nil, err
	}

	cfg = embed.NewConfig()
	cfg.Name = e.Name
	cfg.Dir = e.DataDir
	cfg.WalDir = e.WALDir
	cfg.TickMs = uint(e.HeartbeatIntervalMs)
	cfg.ElectionMs = uint(e.ElectionTimeoutMs)

	cfg.LCUrls = lcURLs
	cfg.ACUrls = acURLs
	cfg.ClientAutoTLS = e.ClientAutoTLS
	cfg.ClientTLSInfo = transport.TLSInfo{
		ClientCertAuth: e.ClientCertAuth,
		CertFile:       e.ClientCertFile,
		KeyFile:        e.ClientKeyFile,
		TrustedCAFile:  e.ClientTrustedCAFile,
	}

	cfg.LPUrls = lpURLs
	cfg.APUrls = apURLs
	cfg.PeerAutoTLS = e.PeerAutoTLS
	cfg.PeerTLSInfo = transport.TLSInfo{
		ClientCertAuth: e.PeerClientCertAuth,
		CertFile:       e.PeerCertFile,
		KeyFile:        e.PeerKeyFile,
		TrustedCAFile:  e.PeerTrustedCAFile,
	}

	cfg.InitialCluster = e.InitialCluster
	cfg.ClusterState = e.InitialClusterState
	cfg.InitialClusterToken = e.InitialClusterToken

	cfg.SnapshotCount = uint64(e.SnapshotCount)
	cfg.QuotaBackendBytes = e.QuotaBackendBytes

	cfg.PreVote = e.PreVote
	cfg.ExperimentalInitialCorruptCheck = e.InitialCorruptCheck

	cfg.Logger = e.Logger
	cfg.LogOutputs = e.LogOutputs
	cfg.Debug = e.Debug

	return cfg, nil
}
func (e *Etcd) EmbedConfig() (cfg *embed.Config, err error) {
	var lcURLs types.URLs
	lcURLs, err = types.NewURLs(e.ListenClientURLs)
	if err != nil {
		return nil, err
	}
	var acURLs types.URLs
	acURLs, err = types.NewURLs(e.AdvertiseClientURLs)
	if err != nil {
		return nil, err
	}
	var lpURLs types.URLs
	lpURLs, err = types.NewURLs(e.ListenPeerURLs)
	if err != nil {
		return nil, err
	}
	var apURLs types.URLs
	apURLs, err = types.NewURLs(e.AdvertisePeerURLs)
	if err != nil {
		return nil, err
	}

	cfg = embed.NewConfig()
	cfg.Name = e.Name
	cfg.Dir = e.DataDir
	cfg.WalDir = e.WALDir
	cfg.TickMs = uint(e.HeartbeatIntervalMs)
	cfg.ElectionMs = uint(e.ElectionTimeoutMs)

	cfg.LCUrls = lcURLs
	cfg.ACUrls = acURLs
	cfg.ClientAutoTLS = e.ClientAutoTLS
	cfg.ClientTLSInfo = transport.TLSInfo{
		ClientCertAuth: e.ClientCertAuth,
		CertFile:       e.ClientCertFile,
		KeyFile:        e.ClientKeyFile,
		TrustedCAFile:  e.ClientTrustedCAFile,
	}

	cfg.LPUrls = lpURLs
	cfg.APUrls = apURLs
	cfg.PeerAutoTLS = e.PeerAutoTLS
	cfg.PeerTLSInfo = transport.TLSInfo{
		ClientCertAuth: e.PeerClientCertAuth,
		CertFile:       e.PeerCertFile,
		KeyFile:        e.PeerKeyFile,
		TrustedCAFile:  e.PeerTrustedCAFile,
	}

	cfg.InitialCluster = e.InitialCluster
	cfg.ClusterState = e.InitialClusterState
	cfg.InitialClusterToken = e.InitialClusterToken

	cfg.SnapshotCount = uint64(e.SnapshotCount)
	cfg.QuotaBackendBytes = e.QuotaBackendBytes

	cfg.PreVote = e.PreVote
	cfg.ExperimentalInitialCorruptCheck = e.InitialCorruptCheck

	cfg.Logger = e.Logger
	cfg.LogOutputs = e.LogOutputs
	cfg.Debug = e.Debug

	return cfg, nil
}
// EmbedConfig returns etcd embed.Config.