本文整理汇总了Golang中configuration.Configuration.ApiHttpSslPortString方法的典型用法代码示例。如果您正苦于以下问题:Golang Configuration.ApiHttpSslPortString方法的具体用法?Golang Configuration.ApiHttpSslPortString怎么用?Golang Configuration.ApiHttpSslPortString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类configuration.Configuration
的用法示例。
在下文中一共展示了Configuration.ApiHttpSslPortString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: NewServer
func NewServer(config *configuration.Configuration) (*Server, error) {
log.Info("Opening database at %s", config.DataDir)
db, err := datastore.NewLevelDbDatastore(config.DataDir, config.LevelDbMaxOpenFiles)
if err != nil {
return nil, err
}
clusterConfig := coordinator.NewClusterConfiguration(config)
raftServer := coordinator.NewRaftServer(config, clusterConfig)
coord := coordinator.NewCoordinatorImpl(db, raftServer, clusterConfig)
go coord.SyncLogs()
requestHandler := coordinator.NewProtobufRequestHandler(db, coord, clusterConfig)
protobufServer := coordinator.NewProtobufServer(config.ProtobufPortString(), requestHandler)
eng, err := engine.NewQueryEngine(coord)
if err != nil {
return nil, err
}
raftServer.AssignEngineAndCoordinator(eng, coord)
httpApi := http.NewHttpServer(config.ApiHttpPortString(), config.AdminAssetsDir, eng, coord, coord)
httpApi.EnableSsl(config.ApiHttpSslPortString(), config.ApiHttpCertPath)
adminServer := admin.NewHttpServer(config.AdminAssetsDir, config.AdminHttpPortString())
return &Server{
RaftServer: raftServer,
Db: db,
ProtobufServer: protobufServer,
ClusterConfig: clusterConfig,
HttpApi: httpApi,
Coordinator: coord,
AdminServer: adminServer,
Config: config,
RequestHandler: requestHandler}, nil
}
示例2: NewServer
func NewServer(config *configuration.Configuration) (*Server, error) {
log.Info("Opening database at %s", config.DataDir)
metaStore := metastore.NewStore()
shardDb, err := datastore.NewShardDatastore(config, metaStore)
if err != nil {
return nil, err
}
newClient := func(connectString string) cluster.ServerConnection {
return coordinator.NewProtobufClient(connectString, config.ProtobufTimeout.Duration)
}
writeLog, err := wal.NewWAL(config)
if err != nil {
return nil, err
}
clusterConfig := cluster.NewClusterConfiguration(config, writeLog, shardDb, newClient, metaStore)
raftServer := coordinator.NewRaftServer(config, clusterConfig)
metaStore.SetClusterConsensus(raftServer)
clusterConfig.LocalRaftName = raftServer.GetRaftName()
clusterConfig.SetShardCreator(raftServer)
clusterConfig.CreateFutureShardsAutomaticallyBeforeTimeComes()
coord := coordinator.NewCoordinatorImpl(config, raftServer, clusterConfig, metaStore)
requestHandler := coordinator.NewProtobufRequestHandler(coord, clusterConfig)
protobufServer := coordinator.NewProtobufServer(config.ProtobufListenString(), requestHandler)
raftServer.AssignCoordinator(coord)
httpApi := http.NewHttpServer(config.ApiHttpPortString(), config.ApiReadTimeout, config.AdminAssetsDir, coord, coord, clusterConfig, raftServer)
httpApi.EnableSsl(config.ApiHttpSslPortString(), config.ApiHttpCertPath)
graphiteApi := graphite.NewServer(config, coord, clusterConfig)
adminServer := admin.NewHttpServer(config.AdminAssetsDir, config.AdminHttpPortString())
return &Server{
RaftServer: raftServer,
ProtobufServer: protobufServer,
ClusterConfig: clusterConfig,
HttpApi: httpApi,
GraphiteApi: graphiteApi,
Coordinator: coord,
AdminServer: adminServer,
Config: config,
RequestHandler: requestHandler,
writeLog: writeLog,
shardStore: shardDb}, nil
}