mirror of
https://github.com/Starlio-app/StarlioX
synced 2024-11-05 06:03:57 +03:00
add version for update
This commit is contained in:
parent
e310505efd
commit
06a28ecbc9
1 changed files with 25 additions and 0 deletions
25
api/controllers/version.go
Normal file
25
api/controllers/version.go
Normal file
|
@ -0,0 +1,25 @@
|
|||
package controllers
|
||||
|
||||
import (
|
||||
"gopkg.in/yaml.v2"
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
"github.com/Redume/EveryNasa/api/utils"
|
||||
)
|
||||
|
||||
var Version = func(w http.ResponseWriter, r *http.Request) {
|
||||
file, readErr := os.ReadFile("config.yaml")
|
||||
if readErr != nil {
|
||||
panic(readErr)
|
||||
}
|
||||
|
||||
data := make(map[interface{}]interface{})
|
||||
|
||||
marshalErr := yaml.Unmarshal(file, &data)
|
||||
if marshalErr != nil {
|
||||
panic(marshalErr)
|
||||
}
|
||||
|
||||
utils.Respond(w, utils.Message(true, data["version"].(string)))
|
||||
}
|
Loading…
Reference in a new issue