grim/hgkeeper
Clone
Summary
Browse
Changes
Graph
Add a log message saying that the ssh server is listening
feature/hgweb
2019-12-18, Gary Kramlich
c564dea8d263
Add a log message saying that the ssh server is listening
package
access
import
(
"path/filepath"
"sync"
"github.com/casbin/casbin/v2"
log
"github.com/sirupsen/logrus"
)
var
(
enforcer
*
casbin
.
Enforcer
enforcerLock
sync
.
Mutex
)
func
refreshEnforcer
(
adminRepoPath
string
)
error
{
enforcerLock
.
Lock
()
defer
enforcerLock
.
Unlock
()
modelFile
:=
filepath
.
Join
(
adminRepoPath
,
modelFilename
)
policyFile
:=
filepath
.
Join
(
adminRepoPath
,
policyFilename
)
log
.
Debugf
(
"reading model from %q"
,
modelFile
)
log
.
Debugf
(
"reading policy from %q"
,
policyFile
)
e
,
err
:=
casbin
.
NewEnforcer
(
modelFile
,
policyFile
)
if
err
!=
nil
{
log
.
Errorf
(
"failed to create new enforcer: %v"
,
err
)
return
err
}
enforcer
=
e
return
nil
}