소스 검색

fix(docker): appprofile error

Indexyz 5 년 전
부모
커밋
ac74761cc9
4개의 변경된 파일31개의 추가작업 그리고 28개의 파일을 삭제
  1. 2 1
      Dockerfile
  2. 28 0
      app/envload.php
  3. 0 27
      config/.config.example.php
  4. 1 0
      public/index.php

+ 2 - 1
Dockerfile

@@ -5,6 +5,7 @@ COPY . /var/www
 WORKDIR /var/www
 
 RUN cp config/.config.example.php config/.config.php && \
+    cp config/appprofile.example.php config/appprofile.php && \
     chmod -R 755 storage && \
     chmod -R 777 /var/www/storage/framework/smarty/compile/ && \
     curl -SL https://getcomposer.org/installer -o composer-setup.php && \
@@ -23,4 +24,4 @@ RUN cp config/.config.example.php config/.config.php && \
         echo 'autorestart=true'; \
         echo 'killasgroup=true'; \
         echo 'stopasgroup=true'; \
-    } | tee /etc/supervisor/crond.conf
+    } | tee /etc/supervisor/crond.conf

+ 28 - 0
app/envload.php

@@ -0,0 +1,28 @@
+<?php
+
+// make replace _ENV with env
+function findKeyName($name)
+{
+    global $_ENV;
+    foreach ($_ENV as $configKey => $configValue) {
+        if (strtoupper($configKey) == $name) {
+            return $configKey;
+        }
+    }
+
+    return NULL;
+}
+
+foreach (getenv() as $envKey => $envValue) {
+    global $_ENV;
+    $envUpKey = strtoupper($envKey);
+    // Key starts with UIM_
+    if (substr($envUpKey, 0, 4) == "UIM_") {
+        // Vaild env key, set to _ENV
+        $configKey = substr($envUpKey, 4);
+        $realKey = findKeyName($configKey);
+        if ($realKey != NULL) {
+            $_ENV[$realKey] = $envValue;
+        }
+    }
+}

+ 0 - 27
config/.config.example.php

@@ -546,30 +546,3 @@ foreach ($_ENV['cdn_forwarded_ip'] as $cdn_forwarded_ip) {
         break;
     }
 }
-
-// make replace _ENV with env
-function findKeyName($name)
-{
-    global $_ENV;
-    foreach ($_ENV as $configKey => $configValue) {
-        if (strtoupper($configKey) == $name) {
-            return $configKey;
-        }
-    }
-
-    return NULL;
-}
-
-foreach (getenv() as $envKey => $envValue) {
-    global $_ENV;
-    $envUpKey = strtoupper($envKey);
-    // Key starts with UIM_
-    if (substr($envUpKey, 0, 4) == "UIM_") {
-        // Vaild env key, set to _ENV
-        $configKey = substr($envUpKey, 4);
-        $realKey = findKeyName($configKey);
-        if ($realKey != NULL) {
-            $_ENV[$realKey] = $envValue;
-        }
-    }
-}

+ 1 - 0
public/index.php

@@ -12,6 +12,7 @@ require __DIR__ . '/../vendor/autoload.php';
 require __DIR__ . '/../config/.config.php';
 require __DIR__ . '/../config/appprofile.php';
 require __DIR__ . '/../app/predefine.php';
+require __DIR__ . '/../app/envload.php';
 
 // TODO: legacy boot function
 use App\Services\Boot;