Started reimplementing scheduler

This commit is contained in:
frikky
2020-05-22 18:40:34 +02:00
parent 6dac515dbe
commit 80d3229f3f
3 changed files with 28 additions and 3 deletions
+5
View File
@@ -2,6 +2,11 @@
ORG_ID=Shuffle ORG_ID=Shuffle
ENVIRONMENT_NAME=Shuffle ENVIRONMENT_NAME=Shuffle
# Different locations etc
APP_DOWNLOAD_LOCATION=https://github.com/frikky/shuffle-apps
APP_DOWNLOAD_AUTH_USERNAME=""
APP_DOWNLOAD_AUTH_PASSWORD=""
# Other configs # Other configs
BACKEND_HOSTNAME=shuffle-backend BACKEND_HOSTNAME=shuffle-backend
BACKEND_PORT=5010 BACKEND_PORT=5010
+22 -3
View File
@@ -51,6 +51,7 @@ import (
// Web // Web
// "github.com/gorilla/handlers" // "github.com/gorilla/handlers"
"github.com/gorilla/mux" "github.com/gorilla/mux"
http2 "gopkg.in/src-d/go-git.v4/plumbing/transport/http"
// Old items (cloud) // Old items (cloud)
// "google.golang.org/appengine" // "google.golang.org/appengine"
// "google.golang.org/appengine/memcache" // "google.golang.org/appengine/memcache"
@@ -5658,9 +5659,27 @@ func runInit(ctx context.Context) {
log.Printf("Apps: loading TEST") log.Printf("Apps: loading TEST")
fs := memfs.New() fs := memfs.New()
storer := memory.NewStorage() storer := memory.NewStorage()
r, err := git.Clone(storer, fs, &git.CloneOptions{
URL: "https://github.com/frikky/shuffle-apps", url := os.Getenv("APP_DOWNLOAD_LOCATION")
}) if len(url) == 0 {
url = "https://github.com/frikky/shuffle-apps"
}
username := os.Getenv("APP_DOWNLOAD_AUTH_USERNAME")
password := os.Getenv("APP_DOWNLOAD_AUTH_PASSWORD")
cloneOptions := &git.CloneOptions{
URL: url,
}
if len(username) > 0 && len(password) > 0 {
cloneOptions.Auth = &http2.BasicAuth{
Username: username,
Password: password,
}
}
log.Printf("Getting apps from %s", url)
r, err := git.Clone(storer, fs, cloneOptions)
if err != nil { if err != nil {
log.Printf("Failed loading repo into memory: %s", err) log.Printf("Failed loading repo into memory: %s", err)
+1
View File
@@ -39,6 +39,7 @@ services:
environment: environment:
- ORG_ID=${ORG_ID} - ORG_ID=${ORG_ID}
- DATASTORE_EMULATOR_HOST=shuffle-database:8000 - DATASTORE_EMULATOR_HOST=shuffle-database:8000
- APP_DOWNLOAD_LOCATION=${APP_DOWNLOAD_LOCATION}
restart: unless-stopped restart: unless-stopped
depends_on: depends_on:
- database - database