@@ -52,6 +52,8 @@ type DefaultCache struct {
5252 Timeout configurationtypes.Timeout `json:"timeout"`
5353 // Time to live.
5454 TTL configurationtypes.Duration `json:"ttl"`
55+ // SimpleFS provider configuration.
56+ SimpleFS configurationtypes.CacheProvider `json:"simplefs"`
5557 // Stale time to live.
5658 Stale configurationtypes.Duration `json:"stale"`
5759 // Disable the coalescing system.
@@ -103,7 +105,7 @@ func (d *DefaultCache) GetMode() string {
103105 return d .Mode
104106}
105107
106- // GetNats returns nuts configuration
108+ // GetNats returns nats configuration
107109func (d * DefaultCache ) GetNats () configurationtypes.CacheProvider {
108110 return d .Nats
109111}
@@ -133,6 +135,11 @@ func (d *DefaultCache) GetRegex() configurationtypes.Regex {
133135 return d .Regex
134136}
135137
138+ // GetSimpleFS returns simplefs configuration
139+ func (d * DefaultCache ) GetSimpleFS () configurationtypes.CacheProvider {
140+ return d .SimpleFS
141+ }
142+
136143// GetStorers returns the chianed storers
137144func (d * DefaultCache ) GetStorers () []string {
138145 return d .Storers
@@ -291,7 +298,7 @@ func parseRedisConfiguration(c map[string]interface{}) map[string]interface{} {
291298 }
292299 case "Username" , "Password" , "ClientName" , "ClientSetInfo" , "ClientTrackingOptions" , "SentinelUsername" , "SentinelPassword" , "MasterName" , "IdentitySuffix" :
293300 c [k ] = v
294- case "SendToReplicas" , "ShuffleInit" , "ClientNoTouch" , "DisableRetry" , "DisableCache" , "AlwaysPipelining" , "AlwaysRESP2" , "ForceSingleClient" , "ReplicaOnly" , "ClientNoEvict" :
301+ case "SendToReplicas" , "ShuffleInit" , "ClientNoTouch" , "DisableRetry" , "DisableCache" , "AlwaysPipelining" , "AlwaysRESP2" , "ForceSingleClient" , "ReplicaOnly" , "ClientNoEvict" , "ContextTimeoutEnabled" , "PoolFIFO" , "ReadOnly" , "RouteByLatency" , "RouteRandomly" , "DisableIndentity" :
295302 c [k ] = true
296303 case "SelectDB" , "CacheSizeEachConn" , "RingScaleEachConn" , "ReadBufferEachConn" , "WriteBufferEachConn" , "BlockingPoolSize" , "PipelineMultiplex" , "DB" , "Protocol" , "MaxRetries" , "PoolSize" , "MinIdleConns" , "MaxIdleConns" , "MaxActiveConns" , "MaxRedirects" :
297304 if v == false {
@@ -303,6 +310,45 @@ func parseRedisConfiguration(c map[string]interface{}) map[string]interface{} {
303310 }
304311 case "ConnWriteTimeout" , "MaxFlushDelay" , "MinRetryBackoff" , "MaxRetryBackoff" , "DialTimeout" , "ReadTimeout" , "WriteTimeout" , "PoolTimeout" , "ConnMaxIdleTime" , "ConnMaxLifetime" :
305312 c [k ], _ = time .ParseDuration (v .(string ))
313+ case "MaxVersion" , "MinVersion" :
314+ strV , _ := v .(string )
315+ if strings .HasPrefix (strV , "TLS" ) {
316+ strV = strings .Trim (strings .TrimPrefix (strV , "TLS" ), " " )
317+ }
318+
319+ switch strV {
320+ case "0x0300" , "SSLv3" :
321+ c [k ] = 0x0300
322+ case "0x0301" , "1.0" :
323+ c [k ] = 0x0301
324+ case "0x0302" , "1.1" :
325+ c [k ] = 0x0302
326+ case "0x0303" , "1.2" :
327+ c [k ] = 0x0303
328+ case "0x0304" , "1.3" :
329+ c [k ] = 0x0304
330+ }
331+ case "TLSConfig" :
332+ c [k ] = parseRedisConfiguration (v .(map [string ]interface {}))
333+ }
334+ }
335+
336+ return c
337+ }
338+
339+ func parseSimpleFSConfiguration (c map [string ]interface {}) map [string ]interface {} {
340+ for k , v := range c {
341+ switch k {
342+ case "path" :
343+ c [k ] = v
344+ case "size" :
345+ if v == false {
346+ c [k ] = 0
347+ } else if v == true {
348+ c [k ] = 1
349+ } else {
350+ c [k ], _ = strconv .Atoi (v .(string ))
351+ }
306352 }
307353 }
308354
@@ -441,14 +487,20 @@ func parseConfiguration(cfg *Configuration, h *caddyfile.Dispenser, isGlobal boo
441487 if len (args ) > 0 {
442488 cdn .Dynamic , _ = strconv .ParseBool (args [0 ])
443489 }
490+ case "email" :
491+ cdn .Email = h .RemainingArgs ()[0 ]
444492 case "hostname" :
445493 cdn .Hostname = h .RemainingArgs ()[0 ]
446494 case "network" :
447495 cdn .Network = h .RemainingArgs ()[0 ]
448496 case "provider" :
449497 cdn .Provider = h .RemainingArgs ()[0 ]
498+ case "service_id" :
499+ cdn .ServiceID = h .RemainingArgs ()[0 ]
450500 case "strategy" :
451501 cdn .Strategy = h .RemainingArgs ()[0 ]
502+ case "zone_id" :
503+ cdn .ZoneID = h .RemainingArgs ()[0 ]
452504 default :
453505 return h .Errf ("unsupported cdn directive: %s" , directive )
454506 }
@@ -531,7 +583,7 @@ func parseConfiguration(cfg *Configuration, h *caddyfile.Dispenser, isGlobal boo
531583 return h .Errf ("unsupported nats directive: %s" , directive )
532584 }
533585 }
534- cfg .DefaultCache .Nuts = provider
586+ cfg .DefaultCache .Nats = provider
535587 case "nuts" :
536588 provider := configurationtypes.CacheProvider {Found : true }
537589 for nesting := h .Nesting (); h .NextBlock (nesting ); {
@@ -611,6 +663,22 @@ func parseConfiguration(cfg *Configuration, h *caddyfile.Dispenser, isGlobal boo
611663 return h .Errf ("unsupported regex directive: %s" , directive )
612664 }
613665 }
666+ case "simplefs" :
667+ provider := configurationtypes.CacheProvider {Found : true }
668+ for nesting := h .Nesting (); h .NextBlock (nesting ); {
669+ directive := h .Val ()
670+ switch directive {
671+ case "path" :
672+ urlArgs := h .RemainingArgs ()
673+ provider .Path = urlArgs [0 ]
674+ case "configuration" :
675+ provider .Configuration = parseCaddyfileRecursively (h )
676+ provider .Configuration = parseSimpleFSConfiguration (provider .Configuration .(map [string ]interface {}))
677+ default :
678+ return h .Errf ("unsupported simplefs directive: %s" , directive )
679+ }
680+ }
681+ cfg .DefaultCache .SimpleFS = provider
614682 case "stale" :
615683 args := h .RemainingArgs ()
616684 stale , err := time .ParseDuration (args [0 ])
0 commit comments