Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
minivault
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ub-unibas
cloudservices
minivault
Commits
7520ac85
Commit
7520ac85
authored
5 months ago
by
Juergen Enge
Browse files
Options
Downloads
Patches
Plain Diff
policy watcher looks reacts on create
parent
f397a6a2
Loading
Loading
No related merge requests found
Pipeline
#163911
passed
5 months ago
Stage: publish
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pkg/policy/manager.go
+7
-1
7 additions, 1 deletion
pkg/policy/manager.go
with
7 additions
and
1 deletion
pkg/policy/manager.go
+
7
−
1
View file @
7520ac85
...
...
@@ -6,6 +6,7 @@ import (
"github.com/fsnotify/fsnotify"
"github.com/je4/utils/v2/pkg/zLogger"
"sync"
"time"
)
func
NewManager
(
configFile
string
,
logger
zLogger
.
ZLogger
)
*
Manager
{
...
...
@@ -46,7 +47,12 @@ func (m *Manager) Start(wg *sync.WaitGroup) error {
m
.
logger
.
Info
()
.
Msg
(
"stop watching policies"
)
return
case
event
:=
<-
watcher
.
Events
:
if
event
.
Has
(
fsnotify
.
Write
)
{
if
event
.
Has
(
fsnotify
.
Create
)
{
time
.
Sleep
(
100
*
time
.
Millisecond
)
if
err
:=
m
.
load
();
err
!=
nil
{
m
.
logger
.
Error
()
.
Err
(
err
)
.
Msg
(
"cannot load policies"
)
}
}
else
if
event
.
Has
(
fsnotify
.
Write
)
{
if
err
:=
m
.
load
();
err
!=
nil
{
m
.
logger
.
Error
()
.
Err
(
err
)
.
Msg
(
"cannot load policies"
)
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment