func (c *Config) RPCAddr() string {
	return fmt.Sprintf("localhost:%d", c.RPC.Port)
}
RPCAddr returns the RPC address.
package yorkie
import (
	"fmt"
	"io/ioutil"
	"path/filepath"
	"time"
	"gopkg.in/yaml.v2"
	"github.com/yorkie-team/yorkie/internal/log"
	"github.com/yorkie-team/yorkie/yorkie/backend"
	"github.com/yorkie-team/yorkie/yorkie/backend/db/mongo"
	"github.com/yorkie-team/yorkie/yorkie/backend/sync/etcd"
	"github.com/yorkie-team/yorkie/yorkie/metrics/prometheus"
	"github.com/yorkie-team/yorkie/yorkie/rpc"
)
const (
	DefaultRPCPort     = 11101
	DefaultMetricsPort = 11102
	DefaultMongoConnectionURI     = "mongodb://localhost:27017"
	DefaultMongoConnectionTimeout = 5 * time.Second
	DefaultMongoPingTimeout       = 5 * time.Second
	DefaultMongoYorkieDatabase    = "yorkie-meta"
	DefaultSnapshotThreshold = 500
	DefaultSnapshotInterval  = 100
	DefaultAuthWebhookMaxRetries      = 10
	DefaultAuthWebhookMaxWaitInterval = 3000 * time.Millisecond
	DefaultAuthWebhookCacheAuthTTL    = 10 * time.Second
	DefaultAuthWebhookCacheUnauthTTL  = 10 * time.Second
)
type Config struct {
	RPC     *rpc.Config        `yaml:"RPC"`
	Metrics *prometheus.Config `yaml:"Metrics"`
	Backend *backend.Config    `yaml:"Backend"`
	Mongo   *mongo.Config      `yaml:"Mongo"`
	ETCD    *etcd.Config       `yaml:"ETCD"`
}
func NewConfig() *Config {
	return newConfig(DefaultRPCPort, DefaultMetricsPort, DefaultMongoYorkieDatabase)
}
func NewConfigFromFile(path string) (*Config, error) {
	conf := &Config{}
	file, err := ioutil.ReadFile(filepath.Clean(path))
	if err != nil {
		log.Logger.Error(err)
		return nil, err
	}
	err = yaml.Unmarshal(file, conf)
	if err != nil {
		log.Logger.Error(err)
		return nil, err
	}
	conf.ensureDefaultValue()
	return conf, nil
}