Browse Source

just use json to prevent reencoding

Girish Ramakrishnan 9 years ago
parent
commit
f788f3f859
2 changed files with 21 additions and 22 deletions
  1. 1 1
      Dockerfile
  2. 20 21
      start.sh

+ 1 - 1
Dockerfile

@@ -12,7 +12,7 @@ RUN curl -o /app/code/wp https://raw.githubusercontent.com/wp-cli/builds/gh-page
 RUN chmod +x /app/code/wp
 
 # Get the plugins
-RUN curl -L -o /app/code/authLdap.zip https://github.com/gramakri/authLdap/zipfile/7ac3cbf4368d1ccaf4596db9aae1f9fe96d2b46c
+RUN curl -L -o /app/code/authLdap.zip https://github.com/gramakri/authLdap/archive/7ac3cbf.zip
 RUN curl -L -o /app/code/disable-wordpress-updates.zip https://downloads.wordpress.org/plugin/disable-wordpress-updates.1.4.7.zip
 RUN curl -L -o /app/code/wp-mail-smtp.zip https://downloads.wordpress.org/plugin/wp-mail-smtp.0.9.5.zip
 

+ 20 - 21
start.sh

@@ -64,29 +64,28 @@ $WP option update smtp_auth false
 # configure LDAP
 # https://github.com/heiglandreas/authLdap/blob/master/authLdap.php#L644
 ldapConfig=$(cat <<EOF
-[
-    'Enabled'       => true,
-    'CachePW'       => false,
-    'URI'           => 'ldap://${LDAP_SERVER}:${LDAP_PORT}/${LDAP_USERS_BASE_DN}',
-    'Filter'        => '(uid=%s)',
-    'NameAttr'      => 'displayname',
-    'SecName'       => '',
-    'UidAttr'       => '', // 'uid'
-    'MailAttr'      => '', // 'mail'
-    'WebAttr'       => '',
-    'Groups'        => array([ 'administrator' => 'cn=admins,${LDAP_GROUPS_BASE_DN}' ]),
-    'Debug'         => false,
-    'GroupAttr'     => 'memberof',
-    'GroupFilter'   => '(&(objectClass=user)(uid=%s))',
-    'DefaultRole'   => 'editor',
-    'GroupEnable'   => true,
-    'GroupOverUser' => true,
-    'Version'       => 1
-]
+{
+    "Enabled"       : true,
+    "CachePW"       : false,
+    "URI"           : "ldap://${LDAP_SERVER}:${LDAP_PORT}/${LDAP_USERS_BASE_DN}",
+    "Filter"        : "(uid=%s)",
+    "NameAttr"      : "displayname",
+    "SecName"       : "",
+    "UidAttr"       : "uid",
+    "MailAttr"      : "mail",
+    "WebAttr"       : "",
+    "Groups"        : { "administrator" : "cn=admins,${LDAP_GROUPS_BASE_DN}" },
+    "Debug"         : false,
+    "GroupAttr"     : "memberof",
+    "GroupFilter"   : "(&(objectClass=user)(uid=%s))",
+    "DefaultRole"   : "editor",
+    "GroupEnable"   : true,
+    "GroupOverUser" : true,
+    "Version"       : 1
+}
 EOF
 )
-authLDAPOptions=$(echo "${ldapConfig}" | php5 -r 'echo serialize(eval("return " . file_get_contents("php://stdin") . ";"));')
-$WP option update authLDAPOptions "${authLDAPOptions}"
+$WP --autoload=true --format=json option update authLDAPOptions "${ldapConfig}"
 
 chown -R www-data:www-data /app/data