Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for symfony secrets #22

Merged
merged 1 commit into from
Jun 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Common deploy tasks for projects made at Le Phare.
* [Workflow overview](docs/workflow.md)
* Composer:
* [Private registry](docs/composer/private-registry.md)
* Symfony:
* [Secrets](docs/symfony/secrets.md)

## Role Variables

Expand Down
7 changes: 7 additions & 0 deletions config/before_composer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,10 @@
login_password: "{{ app_database_password }}"
state: dump
target: "{{ ansistrano_deploy_to }}/{{ ansistrano_current_dir }}/{{ db_pull_remote_database_name }}.sql.gz"

- name: Setup {{ symfony_env }} secrets decrypt key
template:
src: symfony/secrets_private.php.j2
dest: "{{ ansistrano_release_path.stdout }}/config/secrets/{{ symfony_env }}/{{ symfony_env }}.decrypt.private.php"
mode: 0644
when: symfony_secret_private_key is defined
13 changes: 13 additions & 0 deletions docs/symfony/secrets.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Symfony secrets

## Conditions

`symfony_secret_private_key` must be set (in the vault).

## When

During `lephare_symfony_before_composer_tasks_file`

## Description

Creates a `decrypt.private.php` file in the `config/secret` directory allowing to use symfony secrets seamlessly.
3 changes: 3 additions & 0 deletions templates/symfony/secrets_private.php.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php // {{ symfony_env }}.decrypt.private on {{ now(False, '%a, %d %b %Y %H:%M:%S %z') }}

return "{{ symfony_secret_private_key }}";