Skip to content

Commit

Permalink
afup#1442 parameters from env vars
Browse files Browse the repository at this point in the history
  • Loading branch information
stakovicz committed Feb 12, 2024
1 parent ec400fd commit 3df9034
Show file tree
Hide file tree
Showing 13 changed files with 129 additions and 219 deletions.
3 changes: 0 additions & 3 deletions .env-dist

This file was deleted.

70 changes: 70 additions & 0 deletions .env.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
## Options to pass to `docker compose up` command
#DOCKER_UP_OPTIONS= -d # -d will launch container in detached mode
#ENABLE_XDEBUG=true # enable the PHP xDebug extension

## App configuration
DATABASE_HOST=db
DATABASE_PORT=3306
DATABASE_NAME=web
DATABASE_USER=afup
DATABASE_PASSWORD=afup

SECRET=ThisTokenIsNotSoSecretChangeIt

GITHUB_CLIENT_ID=id
GITHUB_CLIENT_SECRET=secret

ALGOLIA_APP_ID=DVB92YWTPE
ALGOLIA_BACKEND_API_KEY=78e71e5r5c2Rb353f5a03376gb9878779
ALGOLIA_FRONTEND_API_KEY=74e71e5r5c2Rb353f5a03376gb9878777

HOME_ALGOLIA_ENABLED=false

SLACK_URL=http://yolo

TWITTER_OAUTH_ACCESS_TOKEN=
TWITTER_OAUTH_ACCESS_TOKEN_SECRET=
TWITTER_CONSUMER_KEY=
TWITTER_CONSUMER_SECRET=

MAILCHIMP_API_KEY=
MAILCHIMP_MEMBERS_LIST=
MAILCHIMP_SUBSCRIBERS_LIST=
MAILCHIMP_TECHLETTER_LIST=
MAILCHIMP_TECHLETTER_API_KEY=
MAILCHIMP_TECHLETTER_WEBHOOK_KEY="abc"

TRELLO_API_KEY=
TRELLO_TOKEN=

GOOGLE_MAPS_API_KEY=

MEETUP_API_CONSUMER_KEY=
MEETUP_API_CONSUMER_SECRET=

TECHNO_WATCH_CALENDAR_URL=https://docs.google.com/spreadsheets/d/2cUeAk86Ov7BLYyn0Ad9ge3ecbsdboeQH64wIU9a9Zzp/export?format=csv
TECHNO_WATCH_CALENDAR_KEY=9Yt0feebMyMrUWx

SUPER_APERO_CSV_URL=

GOOGLE_ANALYTICS_ENABLED=false
GOOGLE_ANALYTICS_ID=G-CHPWDR3C1M

[email protected]

SLACK_MEMBERS_LEGACY_TOKEN=aaaa-90909097

SLACK_API_URL=https://slack.com/api
SLACK_MEMBRE_TOKEN=

RECAPTCHA_PUBLIC_KEY=6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI
RECAPTCHA_PRIVATE_KEY=6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe

PAYBOX_DOMAIN_SERVER=preprod-tpeweb.paybox.com
PAYBOX_SECRET_KEY=0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF
PAYBOX_SITE=1999888
PAYBOX_RANG=32
PAYBOX_IDENTIFIANT=110647233

BLOG_API_KEY=123456

3 changes: 0 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,6 @@ jobs:
restore-keys: |
${{ runner.os }}-composer-
- name: Parameters file
run: make app/config/parameters.yml

- name: Composer install
run: composer install --no-scripts

Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ js_dist
# uploads
/htdocs/uploads

/app/config/parameters.yml
/build/
/phpunit.xml
/var/*
Expand Down
7 changes: 2 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var/logs/.docker-build: compose.yml compose.override.yml $(shell find docker -ty
touch var/logs/.docker-build

.env:
cp .env-dist .env
cp .env.dist .env

compose.override.yml:
cp compose.override.yml-dist compose.override.yml
Expand All @@ -47,9 +47,6 @@ assets:
watch:
./node_modules/.bin/webpack --progress --colors --watch

app/config/parameters.yml:
cp app/config/parameters.yml.dist-docker app/config/parameters.yml

init:
make config
make init-db
Expand All @@ -59,7 +56,7 @@ init-db:
CURRENT_UID=$(CURRENT_UID) $(DOCKER_COMPOSE_BIN) run --rm cliphp make db-migrations
CURRENT_UID=$(CURRENT_UID) $(DOCKER_COMPOSE_BIN) run --rm cliphp make db-seed

config: app/config/parameters.yml
config:
CURRENT_UID=$(CURRENT_UID) $(DOCKER_COMPOSE_BIN) run --no-deps --rm cliphp make vendors
CURRENT_UID=$(CURRENT_UID) $(DOCKER_COMPOSE_BIN) run --no-deps --rm cliphp make assets

Expand Down
26 changes: 9 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ Dans chacun des cas, il est possible de spécifier un test dans la ligne de comm
# Paiements avec Paybox

Il est possible de tester les paiements Paybox en environnement de développement.
Pour cela, les identifiant, site et rang [de test](https://www.paybox.com/espace-integrateur-documentation/comptes-de-tests/) sont déjà configurés dans le fichier parameters.yml par défaut.
Pour cela, les identifiant, site et rang [de test](https://www.paybox.com/espace-integrateur-documentation/comptes-de-tests/) sont déjà configurés dans le fichier .env par défaut.

Ensuite pour le paiement il faut utiliser ces informations [de carte](https://www.paybox.com/espace-integrateur-documentation/cartes-de-tests/) (celle _"Carte participant au programme 3-D Secure (enrôlée)"_) :
* Numéro de carte : `1111222233334444`
Expand Down Expand Up @@ -116,17 +116,11 @@ Valider avec le bouton `Register application`

Récupérer le `Client ID`et le `Client secret`

Mettre ces 2 informations dans le fichier
```yaml
# app/config/parameters.yml

parameters:

# ...

# GitHub's connection details
github_client_id: <Client ID GitHub>
github_client_secret: <Client secret GitHub>
Mettre ces 2 informations dans le fichier .env
```dotenv
# .env
GITHUB_CLIENT_ID=<Client ID GitHub>
GITHUB_CLIENT_SECRET=<Client secret GitHub>
```

## Connection Google Map Geocoding (pour les exports des Inscriptions)
Expand All @@ -140,11 +134,9 @@ Créer un projet avec ces paramètres :
Puis dans `Identifiants`, `Créer des identifiants`, récupérer la clé

Mettre cette information dans le fichier
```yaml
# app/config/parameters.yml
parameters:
# ...
google_maps_api_key: <Clé API Google>
```dotenv
# .env
GOOGLE_MAPS_API_KEY=<Clé API Google>
```

Puis dans `API et services` activer l'API `Geocoding API`.
22 changes: 22 additions & 0 deletions app/config/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php
/**
* On charge les parameters depuis le .env avec une conversion de nom en minuscule.
* À la migration vers Symfony 4+ ceci ne sera plus utile.
* On fait ça à cause du bundle Ting qui ne peut utiliser les "%env()%" comme paramètre.
*/
$lines = file(dirname(__FILE__, 3).'/.env', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
foreach ($lines as $line) {

if (strpos(trim($line), '#') === 0) {
continue;
}

list($name, $value) = explode('=', $line, 2);
$name = strtolower(trim($name));
$value = trim($value);
if (is_numeric($value)) {
$value = (int) $value;
}

$container->setParameter($name, $value);
}
3 changes: 2 additions & 1 deletion app/config/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
imports:
- { resource: parameters.yml }
- { resource: config.php }
- { resource: security.yml }
- { resource: services.yml }

Expand Down Expand Up @@ -350,6 +350,7 @@ ting:
charset: utf8mb4
master:
host: "%database_host%"
# TODO FIX ME POURQUOI ????????? "%database_port%" ne fonctionne pas
port: "%database_port%"
user: "%database_user%"
password: "%database_password%"
Expand Down
82 changes: 0 additions & 82 deletions app/config/parameters.yml.dist

This file was deleted.

82 changes: 0 additions & 82 deletions app/config/parameters.yml.dist-docker

This file was deleted.

Loading

0 comments on commit 3df9034

Please sign in to comment.