summaryrefslogtreecommitdiff
path: root/service/reload/config.go
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2020-02-17 19:13:15 +0300
committerValery Piashchynski <[email protected]>2020-02-17 19:13:15 +0300
commit50b46c8d3c0e1f13623e2cd7cbb1302ae66ed308 (patch)
tree71f1ac71fe3e5bf024b199136584e601016ac0c7 /service/reload/config.go
parent25ef7646e2149b6e35945eb4ce50c19db2ef8e27 (diff)
Add reload service
Start to implement Watcher
Diffstat (limited to 'service/reload/config.go')
-rw-r--r--service/reload/config.go41
1 files changed, 41 insertions, 0 deletions
diff --git a/service/reload/config.go b/service/reload/config.go
new file mode 100644
index 00000000..338c6eba
--- /dev/null
+++ b/service/reload/config.go
@@ -0,0 +1,41 @@
+package reload
+
+import "github.com/spiral/roadrunner/service"
+
+// Config is a Reload configuration point.
+type Config struct {
+ // Enable or disable Reload extension, default disable.
+ Enabled bool
+
+ // Watch is general pattern of files to watch. It will be applied to every directory in project
+ Watch []string
+
+ // Services is set of services which would be reloaded in case of FS changes
+ Services map[string]ServiceConfig
+}
+
+type ServiceConfig struct {
+ // Watch is per-service specific files to watch
+ Watch []string
+ // Dirs is per-service specific dirs which will be combined with Watch
+ Dirs []string
+ // Ignore is set of files which would not be watched
+ Ignore []string
+}
+
+
+// Hydrate must populate Config values using given Config source. Must return error if Config is not valid.
+func (c *Config) Hydrate(cfg service.Config) error {
+ if err := cfg.Unmarshal(c); err != nil {
+ return err
+ }
+ return nil
+}
+
+// InitDefaults sets missing values to their default values.
+func (c *Config) InitDefaults() error {
+ //c.Interval = time.Second
+
+ return nil
+}
+