mirror of
https://github.com/speatzle/nfsense.git
synced 2025-05-11 19:08:20 +00:00
32 lines
724 B
Go
32 lines
724 B
Go
package config
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"github.com/r3labs/diff/v3"
|
|
)
|
|
|
|
type GetPendingStatusResult struct {
|
|
Changed bool
|
|
}
|
|
|
|
func (c *Config) GetPendingStatus(ctx context.Context, params struct{}) (GetPendingStatusResult, error) {
|
|
return GetPendingStatusResult{
|
|
Changed: c.ConfigManager.AreChangesPending(),
|
|
}, nil
|
|
}
|
|
|
|
type GetPendingChangelogResult struct {
|
|
Changelog diff.Changelog
|
|
}
|
|
|
|
func (c *Config) GetPendingChangelog(ctx context.Context, params struct{}) (GetPendingChangelogResult, error) {
|
|
log, err := c.ConfigManager.GetPendingChangelog()
|
|
if err != nil {
|
|
return GetPendingChangelogResult{}, fmt.Errorf("Get Pending changelog %w", err)
|
|
}
|
|
return GetPendingChangelogResult{
|
|
Changelog: log,
|
|
}, nil
|
|
}
|