summaryrefslogtreecommitdiff
path: root/service/reload/config.go
diff options
context:
space:
mode:
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
+}
+