]> git.nbdom.net Git - nb.git/commitdiff
profile.d, /etc/dbq/
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Sat, 12 Nov 2016 21:21:31 +0000 (21:21 +0000)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Sat, 12 Nov 2016 21:21:31 +0000 (21:21 +0000)
etc/profile.d/docker.sh
lib/php/db/config.php
lib/php/nb.php

index afab6f5528b607312a07296d001ec7199875abf2..05fe1c2f3244f2d3ea98838670844e692b2eaf9c 100644 (file)
@@ -15,8 +15,9 @@ _docker_name() {
 }
 
 docker_build() {
-  local docker_name=$(_docker_name "$1") || return; shift
-  [ -e Dockerfile ] || exec echo "Dockerfile missing in $(pwd)" 1>&2
+  
+  local docker_name=$(_docker_name "$1") || return ; shift
+  [ ! -e Dockerfile ] && echo "Dockerfile missing in $(pwd)" 1>&2 && return
 
   if [ -n "$(docker images -q $docker_name 2>/dev/null)" ]; then
     echo "$docker_name already build."
@@ -38,9 +39,9 @@ docker_build() {
 
 docker_run() {
   local docker_name=$(_docker_name "$1") || return
-  [ -n "$1" -a -d "$1" ] && cd "$1"
+  #[ -n "$1" -a -d "$1" ] && cd "$1"
   shift
-  perl -ne '/^\s*\#\s*DOCKER_RUN\s*(.*?)$/ and $RUN=1 and system "$1"; END{exit ($RUN ? 0 : 1)}' Dockerfile && return
+  [ -e Dockerfile ] && perl -ne '/^\s*\#\s*DOCKER_RUN\s*(.*?)$/ and $RUN=1 and system "$1"; END{exit ($RUN ? 0 : 1)}' Dockerfile && return
   docker run --rm -it --name $docker_name --hostname $docker_name $@ $docker_name
 }
 
index 6b482fc93a3e1fbfcd50b5cc6d361314aae4facd..fe94fa823eac52f09bc574ae28f0579c8dfa5639 100644 (file)
@@ -2,13 +2,17 @@
 require_once(realpath(dirname(__FILE__).'/../config.php'));
 require_once(realpath(dirname(__FILE__).'/../db.php'));
 
-$DB_CONFS = Db::conf_load([
+$DB_CONFS = Db::conf_load(
+glob('/etc/dbq/*.yaml')+
+glob('/etc/dbq/*.php')+
+[
   Db::ROOT_DIR.'/etc/dbs.yaml',
   Db::ROOT_DIR.'/etc/dbs.php',
 
   Db::ROOT_DIR.'/etc/dbq.yaml',
   Db::ROOT_DIR.'/etc/dbq.php',
 
+
   '/etc/dbs.yaml',
   '/etc/dbq.yaml',
 
index 683bd82139dfeb0db185d994a7e8447f4089eaa8..0e284e61c02c98e79ba3580c94e43740a12adfb7 100644 (file)
@@ -715,15 +715,15 @@ class NB {
 
   public static function ls_dir($path,$exp='',$recurse=false) {
 
-    $ls = array();
+    $ls = [];
     $rep = opendir($path);
-    #die(">>>".$exp);
 
     while($file = readdir($rep)) {
 
-      if ($file == '.' or $file == '..') continue;
+      if ($file === '' or $file == '.' or $file == '..') continue;
+#die(">>>$file | $exp | $path");
 
-      if (!$exp or preg_match('#'.$exp.'#',$file)) {
+      if (empty($exp) or preg_match('#'.$exp.'#',$file)) {
         $ls[] = $file;
         #$ls[] = "$path/$file";
       }