diff --git a/.gitignore b/.gitignore index 281960a..9397f11 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,9 @@ # # Binaries for programs and plugins * +!*/ !*.* + *.exe *.exe~ *.dll diff --git a/server/gencerts.sh b/server/gencerts.sh deleted file mode 100755 index 432932c..0000000 --- a/server/gencerts.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/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" \ No newline at end of file diff --git a/server/src/modules/database/handlers.go b/server/src/modules/database/handlers.go index e6ae63c..a781332 100644 --- a/server/src/modules/database/handlers.go +++ b/server/src/modules/database/handlers.go @@ -94,25 +94,29 @@ func RetrieveTokenNames() []string { } func InsertTask(name, uuid, command string, nodeids []string, date string, expire time.Time) error { - for _, singleNodeid := range nodeids { - var count int - err := db.QueryRow(declStat.CountDuplTasks, command, singleNodeid).Scan(&count) - if err != nil { - return fmt.Errorf("failed to count the task occurence: %w", err) - } + log.Println(name, uuid, command, nodeids, date, expire) - if count > 0 { - log.Println(WarnTag, "Skipped creation of a task because its a duplicate.") - log.Println(WarnTag, fmt.Sprintf("Details: NodeID: %s, Task name: %s", singleNodeid, name)) - } else { - formattedExpire := expire.Format(utilities.ExtLayout) // Safe format for DB - - _, err = db.Exec(declStat.CreateTask, name, uuid, command, singleNodeid, date, formattedExpire) + /* + for _, singleNodeid := range nodeids { + var count int + err := db.QueryRow(declStat.CountDuplTasks, command, singleNodeid).Scan(&count) if err != nil { - return fmt.Errorf("failed to create task: %w", err) + return fmt.Errorf("failed to count the task occurence: %w", err) + } + + if count > 0 { + log.Println(WarnTag, "Skipped creation of a task because its a duplicate.") + log.Println(WarnTag, fmt.Sprintf("Details: NodeID: %s, Task name: %s", singleNodeid, name)) + } else { + formattedExpire := expire.Format(utilities.ExtLayout) // Safe format for DB + + _, err = db.Exec(declStat.CreateTask, name, uuid, command, singleNodeid, date, formattedExpire) + if err != nil { + return fmt.Errorf("failed to create task: %w", err) + } } } - } + */ return nil }