MCPcopy
hub / github.com/safing/portmaster / start

Function start

service/profile/module.go:86–128  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

84}
85
86func start() error {
87 if err := loadProfilesMetadata(); err != nil {
88 if !errors.Is(err, database.ErrNotFound) {
89 log.Warningf("profile: failed to load profiles metadata, falling back to empty state: %s", err)
90 }
91 meta = &ProfilesMetadata{}
92 }
93 meta.check()
94
95 if err := migrations.Migrate(module.mgr.Ctx()); err != nil {
96 log.Errorf("profile: migrations failed: %s", err)
97 }
98
99 err := registerValidationDBHook()
100 if err != nil {
101 return err
102 }
103
104 err = registerRevisionProvider()
105 if err != nil {
106 return err
107 }
108
109 err = startProfileUpdateChecker()
110 if err != nil {
111 return err
112 }
113
114 module.mgr.Go("clean active profiles", cleanActiveProfiles)
115
116 // Register config callback when starting, as it depends on the updates module,
117 // but the config system will already submit events earlier.
118 if err := registerGlobalConfigProfileUpdater(); err != nil {
119 return err
120 }
121
122 err = updateGlobalConfigProfile(module.mgr.Ctx())
123 if err != nil {
124 log.Warningf("profile: error during loading global profile from configuration: %s", err)
125 }
126
127 return nil
128}
129
130func stop() error {
131 return meta.Save()

Callers 1

StartMethod · 0.70

Calls 13

WarningfFunction · 0.92
ErrorfFunction · 0.92
loadProfilesMetadataFunction · 0.85
registerValidationDBHookFunction · 0.85
registerRevisionProviderFunction · 0.85
MigrateMethod · 0.80
checkMethod · 0.65
CtxMethod · 0.65
IsMethod · 0.45

Tested by

no test coverage detected