-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.go
More file actions
51 lines (42 loc) · 1.2 KB
/
main.go
File metadata and controls
51 lines (42 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
* Data Repository Service
*
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
*
* API version: 1.5.0
* Contact: ga4gh-cloud@ga4gh.org
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package main
import (
"context"
"fmt"
"log"
"net/http"
drs_support "github.com/michael-conway/irods-go-drs/drs-support"
// WARNING!
// Change this to a fully-qualified import path
// once you place this file into your project.
// For example,
//
// sw "github.com/myname/myrepo/irods-drs"
//
sw "github.com/michael-conway/irods-go-drs/internal"
)
func main() {
cfg, err := drs_support.ReadDrsConfig("", "", nil)
if err != nil {
log.Fatalf("read drs config: %v", err)
}
sampler, err := sw.NewServiceInfoSampler(cfg)
if err != nil {
log.Fatalf("create service info sampler: %v", err)
}
sw.SetDefaultServiceInfoSampler(sampler)
if err := sampler.Start(context.Background()); err != nil {
log.Fatalf("start service info sampler: %v", err)
}
log.Printf("Server started on :%d", cfg.DrsListenPort)
router := sw.NewRouter()
log.Fatal(http.ListenAndServe(fmt.Sprintf(":%d", cfg.DrsListenPort), router))
}