Update scripts for new location

This commit is contained in:
Daniel Mason 2021-12-25 13:30:55 +13:00
parent d268d939eb
commit ef66e1c8df
8 changed files with 26 additions and 20 deletions

View file

@ -8,13 +8,8 @@ import (
)
func importImage(uuid string, url string) error {
// Create the file
path, err := os.Getwd()
if err != nil {
return err
}
out, err := os.Create(path + string(os.PathSeparator) + StaticDirectory + string(os.PathSeparator) + "img" + string(os.PathSeparator) + uuid + "_full.jpg")
// Create image
out, err := os.Create(DataDirectory + string(os.PathSeparator) + "img" + string(os.PathSeparator) + uuid + "_full.jpg")
if err != nil {
return err
}

View file

@ -22,8 +22,9 @@ type jsonResponse struct {
// List of Reverse proxies
var ReverseProxies []string
// Static image directory
var StaticDirectory string
// Directories
var FrontendDirectory string
var DataDirectory string
// RequestRequest - Incoming JSON!
type RequestRequest struct {
@ -96,14 +97,14 @@ func HandleRequests(port string) {
r.PathPrefix("/api")
// SERVE STATIC FILES - NO AUTH
spaStatic := spaStaticHandler{staticPath: StaticDirectory}
spaStatic := spaStaticHandler{staticPath: DataDirectory}
r.PathPrefix("/img").Handler(spaStatic)
apiDocs := spaStaticHandler{staticPath: "docs/api/build"}
r.PathPrefix("/docs").Handler(apiDocs)
// SERVE FRONTEND - NO AUTH
spa := spaHandler{staticPath: "web/build", indexPath: "index.html"}
spa := spaHandler{staticPath: FrontendDirectory + string(os.PathSeparator) + "build", indexPath: "index.html"}
r.PathPrefix("/").Handler(spa)
c := cors.New(cors.Options{