# Gitlab private repo as composer package

**URL:** https://discourse.roots.io/t/gitlab-private-repo-as-composer-package/20592
**Category:** trellis
**Created:** 2021-04-13T03:17:42Z
**Posts:** 19
**Showing post:** 13 of 19

## Post 13 by @alwaysblank — 2021-04-14T16:53:58Z

The solution I used for `auth.json` on deployed servers was to have Trellis generate it when deploying. Mostly this was to allow using Delicious Brains’ composer repo, but it could be easily extrapolated to basically anything.

```
# trellis/deploy-hooks/build-before.yml
---
- name: Create composer auth.json
  template:
    src: "{{ playbook_dir }}/deploy-hooks/auth.json.j2"
    dest: "{{ deploy_helper.new_release_path }}/auth.json"
    mode: "0600"
```

```
# trellis/group_vars/all/vault.yml
vault_wordpress_env_defaults:
   vault_deliciousbrains_user: 'a username'
   vault_deliciousbrains_pass: 'a password'
```

```
# trellis/deploy-hooks/auth.json.j2
{
  "http-basic": {
    "composer.deliciousbrains.com": {
      "username": "{{ vault_deliciousbrains_user }}",
      "password": "{{ vault_deliciousbrains_pass }}"
    }
  }
}
```

---

_[View the full topic](https://discourse.roots.io/t/gitlab-private-repo-as-composer-package/20592)._
