diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e226aed6521549a1d36372e271b8b2f5e4f2a5f6..26a85db7514a00521fd9eb6c4d62580cf64f7c72 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -11,6 +11,8 @@ update(144.76.113.134): - which sqlite3 script: - sh build.sh + variables: + STAGE: production update(metager2): tags: @@ -25,6 +27,8 @@ update(metager2): - which sqlite3 script: - sh build.sh + variables: + STAGE: production update(metager3.de): tags: @@ -38,4 +42,6 @@ update(metager3.de): - which php - which sqlite3 script: - - sh build.sh \ No newline at end of file + - sh build.sh + variables: + STAGE: development \ No newline at end of file diff --git a/app/Models/Quicktips/Quicktips.php b/app/Models/Quicktips/Quicktips.php index 1b7b7e046ea4523727db90379496333bb70eb812..0480bf36ef8e73a16500d675d8dbd89735ec7bb4 100644 --- a/app/Models/Quicktips/Quicktips.php +++ b/app/Models/Quicktips/Quicktips.php @@ -11,7 +11,7 @@ class Quicktips { use DispatchesJobs; - const QUICKTIP_URL = "http://localhost:63825/1.1/quicktips.xml"; + private $quicktipUrl = "/1.1/quicktips.xml"; const QUICKTIP_NAME = "quicktips"; const CACHE_DURATION = 60; @@ -19,12 +19,17 @@ class Quicktips public function __construct($search, $locale, $max_time) { + if (env("APP_ENV") === "production") { + $this->quicktipUrl = "https://quicktips.metager.de" . $this->quicktipUrl; + } else { + $this->quicktipUrl = "https://dev.quicktips.metager.de" . $this->quicktipUrl; + } $this->startSearch($search, $locale, $max_time); } public function startSearch($search, $locale, $max_time) { - $url = self::QUICKTIP_URL . "?search=" . $this->normalize_search($search) . "&locale=" . $locale; + $url = $this->quicktipUrl . "?search=" . $this->normalize_search($search) . "&locale=" . $locale; # TODO anders weitergeben $this->hash = md5($url); diff --git a/build.sh b/build.sh index a68e2f0b3184422bf1a365052c3d1e0761e5cfdf..18f64e951a70c1c1c3e504fb11d1183fd29bc85e 100644 --- a/build.sh +++ b/build.sh @@ -8,7 +8,8 @@ if [ -d MetaGer_neu ]; then rm -rf MetaGer_neu;fi git clone "$path" MetaGer_neu cd MetaGer_neu composer install -scp -P 63824 metager@metager3.de:~/.env . +cp $ENVFILE .env +sed -i -e "s/APP_ENV=production/APP_ENV=$STAGE/g" .env cp $SUMAS config/sumas.json cp $SUMASEN config/sumasEn.json scp -P 63824 metager@metager3.de:~/blacklistUrl.txt config/