github.com/ssetin/penguincast@v0.2.0/src/server/props.go (about) 1 // Package iceserver - icecast streaming server 2 package iceserver 3 4 import ( 5 "encoding/json" 6 "io/ioutil" 7 ) 8 9 // Properties ... 10 type Properties struct { 11 Name string `json:"Name"` 12 Admin string `json:"Admin,omitempty"` 13 Location string `json:"Location,omitempty"` 14 Host string `json:"Host"` 15 16 Socket struct { 17 Port int `json:"Port"` 18 } `json:"Socket"` 19 20 Limits struct { 21 Clients int32 `json:"Clients"` 22 Sources int32 `json:"Sources"` 23 SourceIdleTimeOut int `json:"SourceIdleTimeOut"` 24 EmptyBufferIdleTimeOut int `json:"EmptyBufferIdleTimeOut"` 25 WriteTimeOut int `json:"WriteTimeOut"` 26 } `json:"Limits"` 27 28 Auth struct { 29 AdminPassword string `json:"AdminPassword"` 30 } `json:"Auth"` 31 32 Paths struct { 33 Base string `json:"Base"` 34 Web string `json:"Web"` 35 Log string `json:"Log"` 36 } `json:"Paths"` 37 38 Logging struct { 39 Loglevel int `json:"Loglevel"` 40 Logsize int `json:"Logsize"` 41 UseMonitor bool `json:"UseMonitor"` 42 UseStat bool `json:"UseStat"` 43 } `json:"Logging"` 44 45 Mounts []Mount `json:"Mounts"` 46 } 47 48 func (i *IceServer) initConfig() error { 49 cfile, err := ioutil.ReadFile("config.json") 50 if err != nil { 51 return err 52 } 53 54 err = json.Unmarshal(cfile, &i.Props) 55 if err != nil { 56 return err 57 } 58 59 return nil 60 }