@ -76,21 +76,31 @@ func InitGitServices() {
mustInit ( repo_service . Init )
mustInit ( repo_service . Init )
}
}
func syncAppPath ForGit ( ctx context . Context ) error {
func syncAppConf ForGit ( ctx context . Context ) error {
runtimeState := new ( system . RuntimeState )
runtimeState := new ( system . RuntimeState )
if err := system . AppState . Get ( runtimeState ) ; err != nil {
if err := system . AppState . Get ( runtimeState ) ; err != nil {
return err
return err
}
}
updated := false
if runtimeState . LastAppPath != setting . AppPath {
if runtimeState . LastAppPath != setting . AppPath {
log . Info ( "AppPath changed from '%s' to '%s'" , runtimeState . LastAppPath , setting . AppPath )
log . Info ( "AppPath changed from '%s' to '%s'" , runtimeState . LastAppPath , setting . AppPath )
runtimeState . LastAppPath = setting . AppPath
updated = true
}
if runtimeState . LastCustomConf != setting . CustomConf {
log . Info ( "CustomConf changed from '%s' to '%s'" , runtimeState . LastCustomConf , setting . CustomConf )
runtimeState . LastCustomConf = setting . CustomConf
updated = true
}
if updated {
log . Info ( "re-sync repository hooks ..." )
log . Info ( "re-sync repository hooks ..." )
mustInitCtx ( ctx , repo_service . SyncRepositoryHooks )
mustInitCtx ( ctx , repo_service . SyncRepositoryHooks )
log . Info ( "re-write ssh public keys ..." )
log . Info ( "re-write ssh public keys ..." )
mustInit ( asymkey_model . RewriteAllPublicKeys )
mustInit ( asymkey_model . RewriteAllPublicKeys )
runtimeState . LastAppPath = setting . AppPath
return system . AppState . Set ( runtimeState )
return system . AppState . Set ( runtimeState )
}
}
return nil
return nil
@ -153,7 +163,7 @@ func GlobalInitInstalled(ctx context.Context) {
mustInit ( repo_migrations . Init )
mustInit ( repo_migrations . Init )
eventsource . GetManager ( ) . Init ( )
eventsource . GetManager ( ) . Init ( )
mustInitCtx ( ctx , syncAppPath ForGit )
mustInitCtx ( ctx , syncAppConf ForGit )
mustInit ( ssh . Init )
mustInit ( ssh . Init )