{"action":"closed","issue":{"url":"https://api.github.com/repos/aheinze/cockpit-docker/issues/2","repository_url":"https://api.github.com/repos/aheinze/cockpit-docker","labels_url":"https://api.github.com/repos/aheinze/cockpit-docker/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/aheinze/cockpit-docker/issues/2/comments","events_url":"https://api.github.com/repos/aheinze/cockpit-docker/issues/2/events","html_url":"https://github.com/aheinze/cockpit-docker/issues/2","id":142590304,"number":2,"title":"Configure cockpit from environment variables","user":{"login":"andrefreitas","id":1192089,"avatar_url":"https://avatars.githubusercontent.com/u/1192089?v=3","gravatar_id":"","url":"https://api.github.com/users/andrefreitas","html_url":"https://github.com/andrefreitas","followers_url":"https://api.github.com/users/andrefreitas/followers","following_url":"https://api.github.com/users/andrefreitas/following{/other_user}","gists_url":"https://api.github.com/users/andrefreitas/gists{/gist_id}","starred_url":"https://api.github.com/users/andrefreitas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrefreitas/subscriptions","organizations_url":"https://api.github.com/users/andrefreitas/orgs","repos_url":"https://api.github.com/users/andrefreitas/repos","events_url":"https://api.github.com/users/andrefreitas/events{/privacy}","received_events_url":"https://api.github.com/users/andrefreitas/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/aheinze/cockpit-docker/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2016-03-22T09:17:49Z","updated_at":"2016-04-12T18:48:18Z","closed_at":"2016-04-12T18:48:18Z","body":"Hi @aheinze,\r\nI am working in supporting the configuration of the container with environment variables (it's a common approach in Docker):\r\n\r\n```php\r\n<?php\r\n\r\n\r\n$configs = [];\r\n\r\nif (!empty(getenv('COCKPIT_SESSION_NAME'))){\r\n  $configs['session.name'] = getenv('COCKPIT_SESSION_NAME');\r\n}\r\n\r\nif (!empty(getenv('COCKPIT_SALT'))){\r\n  $configs['sec-key'] = getenv('COCKPIT_SALT');\r\n}\r\n\r\nif (!empty(getenv('COCKPIT_I18N'))){\r\n  $configs['i18n'] = getenv('COCKPIT_I18N');\r\n}\r\n\r\nif (!empty(getenv('COCKPIT_DATABASE_SERVER'))){\r\n  $configs['database'] = [\r\n    \"server\"  => getenv('COCKPIT_DATABASE_SERVER'),\r\n    \"options\" => [\"db\" => getenv('COCKPIT_DATABASE_NAME')]\r\n  ];\r\n}\r\n\r\nif (!empty(getenv('COCKPIT_MAILER_FROM'))){\r\n  $configs['mailer'] = [\r\n      \"from\"      => getenv('COCKPIT_MAILER_FROM'),\r\n      \"transport\" => getenv('COCKPIT_MAILER_TRANSPORT'),\r\n      \"host\"      => getenv('COCKPIT_MAILER_HOST'),\r\n      \"user\"      => getenv('COCKPIT_MAILER_USER'),\r\n      \"password\"  => getenv('COCKPIT_MAILER_PASSWORD'),\r\n      \"port\"      => getenv('COCKPIT_MAILER_PORT'),\r\n      \"auth\"      => getenv('COCKPIT_MAILER_AUTH'),\r\n      \"encryption\"=> getenv('COCKPIT_MAILER_ENCRYPTION')\r\n  ];\r\n}\r\nreturn $configs;\r\n```\r\nI am testing cockpit, latest version,  and I am having an error with the MongoDB client. \r\n\r\n```\r\nFatal error: Uncaught Error: Class 'MongoClient' not found \r\n```\r\n\r\nThis is due the fact you are using an old Driver of Mongo: http://php.net/manual/en/class.mongoclient.php\r\n\r\n- Do you have any plans in migrating to the new driver? \r\n- The `next` branch of Cockpit is reading the configs from custom/config.php? (isn't working with that branch)"}}