2017-10-04 53 views
0

在泊坞窗,compose.yml不能添加为环境变量GITLAB_OMNIBUS_CONFIG LDAP多YAML配置,这是因为:gitlab多行配置构成文件

# Add any other gitlab.rb configuration here, each on its own line 
gitlab_rails['ldap_servers'] = YAML.load <<-'EOS' 
main: 
    label: 'LDAP' 
    host: 'ldap.<>.local' 
    port: 389 
    uid: 'uid' 
    bind_dn: 'uid=<>,ou=People,dc=,dc=' 
    password: '<>' 
    encryption: 'plain' # "start_tls" or "simple_tls" or "plain" 
    base: '<>' 
    attributes: 
    username: ['uid', 'userid', 'sAMAccountName'] 
    email: ['mail', 'email', 'userPrincipalName'] 
    name:  'cn' 
    first_name: 'givenName' 
    last_name: 'sn' 
EOS 

有没有解决方案?

回答

0

PS:张贴意见作为答案,因为我需要格式化

你试试下面?

version: '3' 
services: 
    nginx: 
    environment: 
     GITLAB_OMNIBUS_CONFIG: | 
     gitlab_rails['ldap_servers'] = YAML.load <<-'EOS' 
     main: 
      label: 'LDAP' 
      host: 'ldap.<>.local' 
      port: 389 
      uid: 'uid' 
      bind_dn: 'uid=<>,ou=People,dc=,dc=' 
      password: '<>' 
      encryption: 'plain' # "start_tls" or "simple_tls" or "plain" 
      base: '<>' 
      attributes: 
      username: ['uid', 'userid', 'sAMAccountName'] 
      email: ['mail', 'email', 'userPrincipalName'] 
      name:  'cn' 
      first_name: 'givenName' 
      last_name: 'sn' 
     EOS 
    image: nginx 

而且它验证罚款

$ docker-compose config 
services: 
    nginx: 
    environment: 
     GITLAB_OMNIBUS_CONFIG: "gitlab_rails['ldap_servers'] = YAML.load <<-'EOS'\n\ 
     main:\n label: 'LDAP'\n host: 'ldap.<>.local'\n port: 389\n uid: 'uid'\n\ 
     \ bind_dn: 'uid=<>,ou=People,dc=,dc='\n password: '<>'\n encryption: 'plain'\ 
     \ # \"start_tls\" or \"simple_tls\" or \"plain\"\n base: '<>'\n attributes:\n\ 
     \ username: ['uid', 'userid', 'sAMAccountName']\n email: ['mail',\ 
     \ 'email', 'userPrincipalName']\n name:  'cn'\n first_name: 'givenName'\n\ 
     \ last_name: 'sn'\nEOS\n" 
    image: nginx 
version: '3.0' 
+0

不,它不工作。如果我添加多行配置docker-compose说:错误:yaml.scanner.ScannerError:当扫描一个简单的键 在“./docker-compose.yml”,行32列1 找不到预期':' “./docker-compose.yml”第33行第9列 – burtsevyg

+0

32行包含关闭EOS – burtsevyg

+0

@burtsevyg,检查编辑。 –