Starting to save settings

This commit is contained in:
Dillon Shook
2024-10-30 22:34:29 -04:00
parent cb4af866b8
commit 3472ed8dd4
3 changed files with 22 additions and 7 deletions
+4 -1
View File
@@ -249,7 +249,10 @@ class DataStore {
const goAccessInfo = (self.data.get(GOACCESS_INFO) ||
{}) as GoAccessInfo
goAccessInfo.isEnabled = goAccessInfo.isEnabled || false
goAccessInfo.data = goAccessInfo.data || {}
goAccessInfo.data.rotationFrequencyCron =
goAccessInfo.data.rotationFrequencyCron ?? '0 0 1 * *' // monthly
goAccessInfo.data.catchupFrequencyCron =
goAccessInfo.data.catchupFrequencyCron ?? '*/10 * * * *' // every 10 minutes
return goAccessInfo
}
+3 -1
View File
@@ -1,6 +1,8 @@
export class GoAccessInfo {
public isEnabled: boolean
public data: {
temp: boolean
rotationFrequencyCron: string
catchupFrequencyCron: string
logRetentionDays?: number
}
}
+15 -5
View File
@@ -681,8 +681,16 @@ class CaptainManager {
.then(function () {
return self.dataStore.setGoAccessInfo(goAccessInfo)
})
.then(function () {
return dockerApi.ensureContainerStoppedAndRemoved(
CaptainConstants.goAccessContainerName,
CaptainConstants.captainNetworkName
)
})
.then(function () {
if (enabled) {
// const crontab = self.generateGoAccessCrontab(goAccessInfo);
return dockerApi.createStickyContainer(
CaptainConstants.goAccessContainerName,
CaptainConstants.configs.goAccessImageName,
@@ -702,11 +710,6 @@ class CaptainManager {
['apparmor:unconfined'],
undefined
)
} else {
return dockerApi.ensureContainerStoppedAndRemoved(
CaptainConstants.goAccessContainerName,
CaptainConstants.captainNetworkName
)
}
})
.then(function () {
@@ -717,6 +720,13 @@ class CaptainManager {
})
}
generateGoAccessCrontab(goAccessInfo: GoAccessInfo): string {
return [
'* * * * * /realtimeLog.sh',
'*/5 * * * * /processLogs.sh',
].join('\n')
}
getNodesInfo() {
const dockerApi = this.dockerApi