Add a channel_defaults configuration#97
Conversation
Add a channel_defaults configuration option which is merged with the channel configuration to allow global configuration options like insecure_skip_verify to be specified at startup time.
|
But why didn't you use a simple server structure? "server": {
"debug": true,
"http_debug": false,
"http_demo": true,
"channel_defaults": {
"on_demand": true,
}//ServerGetCDOnDaemand read debug options
func (obj *StorageST) ServerGetCDOnDaemand() bool {
obj.mutex.RLock()
defer obj.mutex.RUnlock()
return obj.Server.CD.OnDemand
}I'm not sure if the library should be used here github.com/imdario/mergo Let's think about how to do without it sorry I think this might add to the problem. |
My initial thought was just that any option could be global without extra work, however, it is more 'magic' and potentially complex. No problem, I can:
|
|
maybe OnDemand bool `json:"on_demand,omitempty" groups:"api,config"`change to OnDemand *bool `json:"on_demand,omitempty" groups:"api,config"`Line 48 in 92cea27
func (obj *StorageST) loadDefaults() (*ChannelST, error) {
//create defaults
if obj.OnDemand == nil {
//use defaults
}else{
//use OnDemand = *obj.OnDemand
}
}
|
|
I understood your idea, and it is good, but I would consider doing it without using external libraries, taking only part of their functions. |
|
there is another idea. Defaults ChannelST `json:"defaults,omitempty" groups:"api,config"` //default audio == true
//channel audio == false (not set)
def, _ := json.Marshal(tmp.Server.Defaults)
for i, i2 := range tmp.Streams {
for i3, i4 := range i2.Channels {
log.Println(i4.Audio)
//result false
json.Unmarshal(def, &i4)
log.Fatalln(i4.Audio)
//result true
....if the parameters were pointers it would work just fine but right now it replaces. |
|
Perhaps you are still right and this option is completely acceptable. thx you |
|
Can we create a chat in telegram or skype? |
How about discord? |
Add a channel_defaults configuration option which is merged with the channel configuration to allow global configuration options like insecure_skip_verify to be specified at startup time, though is flexible to support other options too in the future.
Issue #82