Skip to content
Draft
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
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
APP_ENV=dev
14 changes: 14 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
APP_ENV=test

DATABASE_HOST=dbtest
DATABASE_PORT=3306
DATABASE_NAME=web
DATABASE_USER=afup
DATABASE_PASSWORD=afup

MAILCHIMP_API_KEY=xxx-yyyy
MAILCHIMP_MEMBERS_LIST=
MAILCHIMP_SUBSCRIBERS_LIST=
MAILCHIMP_TECHLETTER_LIST=
MAILCHIMP_TECHLETTER_API_KEY=xxx-yyyy
MAILCHIMP_TECHLETTER_WEBHOOK_KEY="abc"
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
.env
/.env.local
/.env.local.php
/.env.*.local

deps.lock
.idea
Expand Down
7 changes: 3 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
-include .env
default: help

# Variables
Expand Down Expand Up @@ -51,7 +50,7 @@ init: htdocs/uploads
##@ Docker

### Démarrer les containers
docker-up: .env var/logs/.docker-build data compose.override.yml
docker-up: .env.dev.local var/logs/.docker-build data compose.override.yml
$(DOCKER_COMP) up $(DOCKER_UP_OPTIONS)

### Stopper les containers
Expand Down Expand Up @@ -154,8 +153,8 @@ var/logs/.docker-build: compose.yml compose.override.yml $(shell find docker -ty
CURRENT_UID=$(CURRENT_UID) ENABLE_XDEBUG=$(ENABLE_XDEBUG) $(DOCKER_COMPOSE_BIN) build
touch var/logs/.docker-build

.env:
cp .env.dist .env
.env.local:
cp .env.dist .env.local

compose.override.yml:
cp compose.override.yml-dist compose.override.yml
Expand Down
32 changes: 0 additions & 32 deletions app/config/config.php

This file was deleted.

1 change: 0 additions & 1 deletion app/config/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
imports:
- { resource: config.php }
- { resource: services.yml }
- { resource: packages/*.yaml }
4 changes: 2 additions & 2 deletions app/config/packages/ewz_recaptcha.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
ewz_recaptcha:
public_key: '%recaptcha_public_key%'
private_key: '%recaptcha_private_key%'
public_key: '%env(RECAPTCHA_PUBLIC_KEY)%'
private_key: '%env(RECAPTCHA_PRIVATE_KEY)%'
2 changes: 1 addition & 1 deletion app/config/packages/framework.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ framework:
fallbacks: ["%locale%"]
enabled: true
default_path: "%kernel.project_dir%/../translations"
secret: "%secret%"
secret: "%env(SECRET)%"
router:
resource: "%kernel.project_dir%/config/routing.yml"
strict_requirements: ~
Expand Down
4 changes: 2 additions & 2 deletions app/config/packages/knpu_oauth2_client.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ knpu_oauth2_client:
# will create a service: knpu.oauth2.client.facebook_main
github_main:
type: github
client_id: "%github_client_id%"
client_secret: "%github_client_secret%"
client_id: "%env(GITHUB_CLIENT_ID)%"
client_secret: "%env(GITHUB_CLIENT_SECRET)%"
# see below
redirect_route: connection_github_check
2 changes: 1 addition & 1 deletion app/config/packages/security.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ security:
- { path: ^/admin/(members/reporting|association/relances|talk|slackmembers/check|healthcheck), roles: ROLE_ADMIN}
- { path: ^/member, roles: [ROLE_USER, ROLE_MEMBER_EXPIRED]}
- { path: ^/admin/, roles: ROLE_MEMBER_EXPIRED }
- { path: ^/blog, allow_if: "request.getClientIp() in ['217.70.189.71', '127.0.0.1', '192.168.42.1'] or request.server.get('ALLOW_BLOG_FROM_ALL') == 1 or request.headers.get('x-afup-blog-api-key') == '%blog_api_key%'" }
- { path: ^/blog, allow_if: "request.getClientIp() in ['217.70.189.71', '127.0.0.1', '192.168.42.1'] or request.server.get('ALLOW_BLOG_FROM_ALL') == 1 or request.headers.get('x-afup-blog-api-key') == '%env(BLOG_API_KEY)%'" }
- { path: ^/blog, roles: ROLE_NO_ACCESS }
- { path: ^/(event/\w+/tickets|association)paybox-callback, roles: PUBLIC_ACCESS, ips: "%paybox_ips%" }
- { path: ^/(event/\w+/tickets|association)paybox-callback, roles: ROLE_SUPER_ADMIN }
Expand Down
22 changes: 11 additions & 11 deletions app/config/packages/ting.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ ting:
namespace: CCMBenchmark\Ting\Driver\Mysqli
charset: utf8mb4
master:
host: "%database_host%"
port: "%database_port%"
user: "%database_user%"
password: "%database_password%"
host: "%env(DATABASE_HOST)%"
port: "%env(int:DATABASE_PORT)%"
user: "%env(DATABASE_USER)%"
password: "%env(DATABASE_PASSWORD)%"

repositories:
event:
Expand All @@ -16,46 +16,46 @@ ting:
options:
default:
connection: main
database: '%database_name%'
database: '%env(DATABASE_NAME)%'
site:
namespace : AppBundle\Site\Model\Repository
directory : "@AppBundle/Site/Model/Repository"
options:
default:
connection: main
database: '%database_name%'
database: '%env(DATABASE_NAME)%'
accounting:
namespace: AppBundle\Accounting\Model\Repository
directory: "@AppBundle/Accounting/Model/Repository"
options:
default:
connection: main
database: "%database_name%"
database: "%env(DATABASE_NAME)%"
association:
namespace : AppBundle\Association\Model\Repository
directory : "@AppBundle/Association/Model/Repository"
options:
default:
connection: main
database: '%database_name%'
database: '%env(DATABASE_NAME)%'
membershipfee:
namespace: AppBundle\MembershipFee\Model\Repository
directory: "@AppBundle/MembershipFee/Model/Repository"
options:
default:
connection: main
database: "%database_name%"
database: "%env(DATABASE_NAME)%"
throttling:
namespace : AppBundle\Security\ActionThrottling
directory : "@AppBundle/Security/ActionThrottling"
options:
default:
connection: main
database: '%database_name%'
database: '%env(DATABASE_NAME)%'
techletter:
namespace: AppBundle\TechLetter\Model\Repository
directory: "@AppBundle/TechLetter/Model/Repository"
options:
default:
connection: main
database: "%database_name%"
database: "%env(DATABASE_NAME)%"
2 changes: 1 addition & 1 deletion app/config/packages/twig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ twig:
strict_variables: "%kernel.debug%"
globals:
photo_storage: '@AppBundle\CFP\PhotoStorage'
global_menu_event_label: '%afup_global_menu_event_label%'
global_menu_event_label: '%env(AFUP_GLOBAL_MENU_EVENT_LABEL)%'
form_themes: ['form_theme.html.twig']
exception_controller: null
default_path: "%kernel.project_dir%/../templates"
45 changes: 23 additions & 22 deletions app/config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ parameters:
app.badge_dir: "%kernel.project_dir%/../htdocs/uploads/badges"
app.members_logo_dir: "%kernel.project_dir%/../htdocs/uploads/members_logo"
app.general_meetings_dir: "%kernel.project_dir%/../htdocs/uploads/general_meetings_reports"
bluesky.api.identifier: "%bluesky_api_identifier%"
bluesky.api.app_password: "%bluesky_api_app_password%"
bluesky.api.identifier: "%env(BLUESKY_API_IDENTIFIER)%"
bluesky.api.app_password: "%env(BLUESKY_API_APP_PASSWORD)%"

services:
# service_name:
Expand All @@ -26,9 +26,9 @@ services:
Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler:
public: false
arguments:
- 'mysql:host=%database_host%;port=%database_port%;dbname=%database_name%'
- db_username: '%database_user%'
db_password: '%database_password%'
- 'mysql:host=%env(DATABASE_HOST)%;port=%env(int:DATABASE_PORT)%;dbname=%env(DATABASE_NAME)%'
- db_username: '%env(DATABASE_USER)%'
db_password: '%env(DATABASE_PASSWORD)%'
lock_mode: !php/const Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler::LOCK_NONE

Laminas\Feed\Reader\Http\ClientInterface: '@PlanetePHP\SymfonyFeedClient'
Expand Down Expand Up @@ -81,19 +81,19 @@ services:

AppBundle\Payment\PayboxFactory:
autowire: true
arguments: ["@router", "%paybox_domain_server%", "%paybox_secret_key%", "%paybox_site%", "%paybox_rang%", "%paybox_identifiant%"]
arguments: ["@router", "%env(PAYBOX_DOMAIN_SERVER)%", "%env(PAYBOX_SECRET_KEY)%", "%env(PAYBOX_SITE)%", "%env(PAYBOX_RANG)%", "%env(PAYBOX_IDENTIFIANT)%"]

AppBundle\Slack\LegacyClient:
arguments: ["%slack_members_legacy_token%"]
arguments: ["%env(SLACK_MEMBERS_LEGACY_TOKEN)%"]

Algolia\AlgoliaSearch\SearchClient:
factory: [ Algolia\AlgoliaSearch\SearchClient, create ]
arguments: ["%algolia_app_id%", "%algolia_backend_api_key%"]
arguments: ["%env(ALGOLIA_APP_ID)%", "%env(ALGOLIA_BACKEND_API_KEY)%"]

# API/Client Meetup techletter
app.mailchimp_techletter_client:
class: DrewM\MailChimp\MailChimp
arguments: ["%mailchimp_techletter_api_key%"]
arguments: ["%env(MAILCHIMP_TECHLETTER_API_KEY)%"]
public: false
app.mailchimp_techletter_api:
class: AppBundle\Mailchimp\Mailchimp
Expand All @@ -103,7 +103,7 @@ services:
# API/Client Meetup
app.mailchimp_client:
class: DrewM\MailChimp\MailChimp
arguments: ["%mailchimp_api_key%"]
arguments: ["%env(MAILCHIMP_API_KEY)%"]
public: false
app.mailchimp_api:
class: AppBundle\Mailchimp\Mailchimp
Expand All @@ -114,23 +114,27 @@ services:
autowire: true
arguments:
$mailchimp: '@app.mailchimp_techletter_api'
$listId: "%mailchimp_techletter_list%"
$listId: "%env(MAILCHIMP_TECHLETTER_LIST)%"

AppBundle\Mailchimp\MailchimpMembersAutoListSynchronizer:
autowire: true
arguments:
$mailchimp: '@app.mailchimp_api'
$listId: "%mailchimp_members_list%"
$listId: "%env(MAILCHIMP_MEMBERS_LIST)%"

AppBundle\Email\Mailer\Adapter\MailerAdapter:
class: AppBundle\Email\Mailer\Adapter\PhpMailerAdapter
factory: [AppBundle\Email\Mailer\Adapter\PhpMailerAdapter, createFromConfiguration]
arguments: ['@Afup\Site\Utils\Configuration']
class: AppBundle\Email\Mailer\Adapter\PhpMailerAdapter
arguments:
$smtpServer: '%env(SMTP_HOST)%'
$tls: '%env(SMTP_TLS)%'
$username: '%env(SMTP_USERNAME)%'
$password: '%env(SMTP_PASSWORD)%'
$port: '%env(SMTP_PORT)%'

AppBundle\Mailchimp\EventEventSubscriber:
arguments:
- '@app.mailchimp_api'
- "%mailchimp_members_list%"
- "%env(MAILCHIMP_MEMBERS_LIST)%"
tags:
- { name: kernel.event_listener, event: user.disabled, method: onUserDisabled }

Expand All @@ -140,10 +144,7 @@ services:

AppBundle\Event\Ticket\QrCodeGenerator:
autowire: true
arguments: ["%qr_code_salt%"]

Afup\Site\Utils\Configuration:
autowire: true
arguments: ["%env(QR_CODE_SALT)%"]

Afup\Site\Utils\LegacyConnectionFactory: ~
Afup\Site\Utils\Base_De_Donnees:
Expand Down Expand Up @@ -189,7 +190,7 @@ services:

geocoder_provider_google_maps:
class: Geocoder\Provider\GoogleMaps\GoogleMaps
arguments: ['@Psr\Http\Client\ClientInterface', null, "%google_maps_api_key%"]
arguments: ['@Psr\Http\Client\ClientInterface', null, "%env(GOOGLE_MAPS_API_KEY)%"]

AppBundle\Offices\OfficeFinder:
arguments: ['@geocoder']
Expand All @@ -203,7 +204,7 @@ services:
Doctrine\DBAL\Connection:
factory: '@AppBundle\Doctrine\ConnectionFactory'
arguments:
$url: 'mysql://%database_user%:%database_password%@%database_host%:%database_port%/%database_name%?charset=utf8mb4'
$url: 'mysql://%env(DATABASE_USER)%:%env(DATABASE_PASSWORD)%@%env(DATABASE_HOST)%:%env(DATABASE_PORT)%/%env(DATABASE_NAME)%?charset=utf8mb4'

AppBundle\Github\GithubClient:
arguments:
Expand Down
3 changes: 3 additions & 0 deletions bin/console
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
use AppBundle\AppKernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Dotenv\Dotenv;

// if you don't want to setup permissions the proper way, just uncomment the following PHP line
// read http://symfony.com/doc/current/book/installation.html#configuration-and-setup for more information
Expand All @@ -18,6 +19,8 @@ $input = new ArgvInput();
$env = $input->getParameterOption(['--env', '-e'], getenv('APP_ENV') ?: 'dev');
$debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption(['--no-debug', '']) && $env !== 'prod';

(new Dotenv())->bootEnv(dirname(__DIR__) . '/.env');

$kernel = new AppKernel($env, $debug);
$application = new Application($kernel);
$application->run($input);
10 changes: 3 additions & 7 deletions compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ services:
- ./data/mysqltest:/var/lib/mysql
healthcheck:
test: [ "CMD", "mysqladmin", "ping", "-h", "localhost" ]
timeout: 20s
timeout: 3s
retries: 10

apachephp:
Expand All @@ -32,11 +32,9 @@ services:
gid: "1001"
ENABLE_XDEBUG: ${ENABLE_XDEBUG:-false}
environment:
APP_ENV: "dev"
APP_ENV: "${APP_ENV:-dev}"
HOST_PWD: ${PWD}
SYMFONY_IDE: "%env(IDE_USED)%://open?url=file://%%f&line=%%l&/var/www/html/>%env(HOST_PWD)%/"
env_file:
.env
volumes:
- ./:/var/www/html
links:
Expand All @@ -51,11 +49,9 @@ services:
gid: "1001"
ENABLE_XDEBUG: ${ENABLE_XDEBUG:-false}
environment:
APP_ENV: "test"
APP_ENV: "${APP_ENV:-test}"
HOST_PWD: ${PWD}
SYMFONY_IDE: "%env(IDE_USED)%://open?url=file://%%f&line=%%l&/var/www/html/>%env(HOST_PWD)%/"
env_file:
.env
volumes:
- ./:/var/www/html
links:
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"symfony/asset": "7.3.*",
"symfony/clock": "7.3.*",
"symfony/console": "7.3.*",
"symfony/dotenv": "^7.4",
"symfony/expression-language": "7.3.*",
"symfony/form": "7.3.*",
"symfony/framework-bundle": "7.3.*",
Expand Down
Loading
Loading