parent
cdbab95930
commit
b4574eb73d
|
@ -0,0 +1,13 @@
|
||||||
|
Copyright [2024] [Daniel Legt]
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
10
README.md
10
README.md
|
@ -44,4 +44,12 @@ WantedBy=multi-user.target
|
||||||
Currently the program does not depend on any hardware library as I couldn't find anything that would not require root access while giving me the possibility to interrogate the temperature of the drives, I chose not to depend on `lsblk` either, so how does the program work? Well it looks in `/sys/block` and simply
|
Currently the program does not depend on any hardware library as I couldn't find anything that would not require root access while giving me the possibility to interrogate the temperature of the drives, I chose not to depend on `lsblk` either, so how does the program work? Well it looks in `/sys/block` and simply
|
||||||
|
|
||||||
### Why not just run as root?
|
### Why not just run as root?
|
||||||
I really, really, **really** want to avoid asking people to run **ANY** program I write as root and even try and prevent that from happening since that's how things can go bad, especially because I am runnig actions over hardware items. I think you can see how easy it is for a mistake or a **malicious attack** to easily deal damage
|
I really, really, **really** want to avoid asking people to run **ANY** program I write as root and even try and prevent that from happening since that's how things can go bad, especially because I am runnig actions over hardware items. I think you can see how easy it is for a mistake or a **malicious attack** to easily deal damage
|
||||||
|
|
||||||
|
## Support & Contribution
|
||||||
|
|
||||||
|
For support, bug reports, or feature requests, please open an issue on the [GitHub repository](https://github.com/JustKato/drive-health/issues). Contributions are welcome! Fork the repository, make your changes, and submit a pull request.
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
This project is licensed under the [Apache License 2.0](./LICENSE).
|
2
go.mod
2
go.mod
|
@ -1,4 +1,4 @@
|
||||||
module tea.chunkbyte.com/kato/drive-health
|
module github.com/JustKato/drive-health
|
||||||
|
|
||||||
go 1.21.6
|
go 1.21.6
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,8 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/JustKato/drive-health/lib/config"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
"tea.chunkbyte.com/kato/drive-health/lib/config"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetSystemHardDrives(db *gorm.DB, olderThan *time.Time, newerThan *time.Time) ([]*HardDrive, error) {
|
func GetSystemHardDrives(db *gorm.DB, olderThan *time.Time, newerThan *time.Time) ([]*HardDrive, error) {
|
||||||
|
|
|
@ -5,11 +5,11 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/JustKato/drive-health/lib/config"
|
||||||
|
"github.com/JustKato/drive-health/lib/hardware"
|
||||||
"github.com/wcharczuk/go-chart/v2"
|
"github.com/wcharczuk/go-chart/v2"
|
||||||
"gorm.io/driver/sqlite"
|
"gorm.io/driver/sqlite"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
"tea.chunkbyte.com/kato/drive-health/lib/config"
|
|
||||||
"tea.chunkbyte.com/kato/drive-health/lib/hardware"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var db *gorm.DB
|
var db *gorm.DB
|
||||||
|
|
|
@ -4,8 +4,8 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"tea.chunkbyte.com/kato/drive-health/lib/config"
|
"github.com/JustKato/drive-health/lib/config"
|
||||||
"tea.chunkbyte.com/kato/drive-health/lib/hardware"
|
"github.com/JustKato/drive-health/lib/hardware"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Delete all thermal entries that are older than X amount of seconds
|
// Delete all thermal entries that are older than X amount of seconds
|
||||||
|
|
|
@ -5,9 +5,9 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/JustKato/drive-health/lib/hardware"
|
||||||
|
"github.com/JustKato/drive-health/lib/svc"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"tea.chunkbyte.com/kato/drive-health/lib/hardware"
|
|
||||||
"tea.chunkbyte.com/kato/drive-health/lib/svc"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func setupApi(r *gin.Engine) {
|
func setupApi(r *gin.Engine) {
|
||||||
|
|
|
@ -6,9 +6,9 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/JustKato/drive-health/lib/hardware"
|
||||||
|
"github.com/JustKato/drive-health/lib/svc"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"tea.chunkbyte.com/kato/drive-health/lib/hardware"
|
|
||||||
"tea.chunkbyte.com/kato/drive-health/lib/svc"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func setupFrontend(r *gin.Engine) {
|
func setupFrontend(r *gin.Engine) {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package web
|
package web
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/JustKato/drive-health/lib/config"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"tea.chunkbyte.com/kato/drive-health/lib/config"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func SetupRouter() *gin.Engine {
|
func SetupRouter() *gin.Engine {
|
||||||
|
|
6
main.go
6
main.go
|
@ -9,10 +9,10 @@ import (
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/JustKato/drive-health/lib/config"
|
||||||
|
"github.com/JustKato/drive-health/lib/svc"
|
||||||
|
"github.com/JustKato/drive-health/lib/web"
|
||||||
"github.com/joho/godotenv"
|
"github.com/joho/godotenv"
|
||||||
"tea.chunkbyte.com/kato/drive-health/lib/config"
|
|
||||||
"tea.chunkbyte.com/kato/drive-health/lib/svc"
|
|
||||||
"tea.chunkbyte.com/kato/drive-health/lib/web"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
Loading…
Reference in New Issue