Renames and updates

This commit is contained in:
Daan Selen
2025-06-04 08:52:49 +02:00
parent fa6725e77c
commit 04a3306555
6 changed files with 29 additions and 11 deletions

6
.gitignore vendored
View File

@@ -1,9 +1,3 @@
# Ignore all
*
# Unignore all with extensions
!*.*
# ---> Go # ---> Go
# If you prefer the allow list template instead of the deny list, see community template: # If you prefer the allow list template instead of the deny list, see community template:
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore # https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore

8
server/gencerts.sh Executable file
View File

@@ -0,0 +1,8 @@
#!/bin/bash
echo "Generating..."
openssl genpkey -algorithm RSA -out ./hmac_key.pem -pkeyopt rsa_keygen_bits:4096
openssl req -new -newkey rsa:4096 -x509 -sha256 -days 365 -nodes -keyout api_key.pem -out api_cert.pem \
-subj "/C=NL/ST=Noord-Holland/L=Amsterdam/O=ExOrg/OU=IT/CN=localhost"

BIN
server/ghostrunner-server Executable file

Binary file not shown.

View File

@@ -0,0 +1,10 @@
package timekeeper
import (
"ghostrunner-server/modules/utilities"
"log"
)
func expireRoutine() {
log.Println(utilities.InfoTag, "Checking for expired tasks.")
}

View File

@@ -11,7 +11,7 @@ import (
"sync" "sync"
) )
func routine(venvName string, pyListArgs []string) { func taskRoutine(venvName string, pyListArgs []string) {
d := listDevices(venvName, pyListArgs) // Retrieve the Online devices. d := listDevices(venvName, pyListArgs) // Retrieve the Online devices.
curTasks := database.RetrieveTasks() curTasks := database.RetrieveTasks()
@@ -39,9 +39,7 @@ func routine(venvName string, pyListArgs []string) {
rawResult := forgeAndExec(venvName, task.Nodeid, task.Command) rawResult := forgeAndExec(venvName, task.Nodeid, task.Command)
pResult := generateResult(rawResult) pResult := generateResult(rawResult)
for idx, item := range pResult { insertResult(pResult)
log.Println(idx, item)
}
log.Println(utilities.InfoTag, "Removing Task from database...") log.Println(utilities.InfoTag, "Removing Task from database...")
database.RemoveTask(task.Name, task.Nodeid) database.RemoveTask(task.Name, task.Nodeid)
@@ -106,3 +104,10 @@ func generateResult(rawOut string) []string {
return result return result
} }
func insertResult(result []string) error {
for idx, item := range result {
log.Println(idx, item)
}
return nil
}

View File

@@ -20,7 +20,8 @@ func KeepTime(interval int, venvName string) {
for range ticker.C { for range ticker.C {
log.Println(utilities.InfoTag, "----------------------------------------") log.Println(utilities.InfoTag, "----------------------------------------")
log.Println(utilities.InfoTag, "Routine Started.") log.Println(utilities.InfoTag, "Routine Started.")
routine(venvName, pyListArgs) expireRoutine()
taskRoutine(venvName, pyListArgs)
log.Println(utilities.InfoTag, "Routine Ended.") log.Println(utilities.InfoTag, "Routine Ended.")
} }
} }