mirror of
https://github.com/Starlio-app/Starlio-web.git
synced 2024-12-27 10:43:46 +03:00
25 lines
463 B
Go
25 lines
463 B
Go
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)))
|
|
}
|