Skip to content

Commit

Permalink
[shopsys] unified config files extension to yaml (#1814)
Browse files Browse the repository at this point in the history
  • Loading branch information
grossmannmartin authored May 5, 2020
1 parent 702146d commit 0861abc
Show file tree
Hide file tree
Showing 78 changed files with 61 additions and 60 deletions.
10 changes: 5 additions & 5 deletions .ci/deploy-to-google-cloud.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ docker image pull ${DOCKER_USERNAME}/elasticsearch:${DOCKER_ELASTIC_IMAGE_TAG} |
sed -i "s/{{GOOGLE_CLOUD_STORAGE_BUCKET_NAME}}/${GOOGLE_CLOUD_STORAGE_BUCKET_NAME}/g" docker/nginx/google-cloud/nginx.conf

# Create real parameters files to be modified and applied to the cluster as configmaps
cp config/domains_urls.yml.dist config/domains_urls.yml
cp config/parameters.yml.dist config/parameters.yml
cp config/domains_urls.yaml.dist config/domains_urls.yaml
cp config/parameters.yaml.dist config/parameters.yaml

DOCKER_PHP_FPM_IMAGE=${DOCKER_USERNAME}/php-fpm:${DOCKER_IMAGE_TAG}
DOCKER_ELASTIC_IMAGE=${DOCKER_USERNAME}/elasticsearch:${DOCKER_ELASTIC_IMAGE_TAG}
Expand All @@ -64,11 +64,11 @@ unset FILES
unset VARS

# Set domain urls
yq write --inplace config/domains_urls.yml domains_urls[0].url https://${FIRST_DOMAIN_HOSTNAME}
yq write --inplace config/domains_urls.yml domains_urls[1].url https://${SECOND_DOMAIN_HOSTNAME}
yq write --inplace config/domains_urls.yaml domains_urls[0].url https://${FIRST_DOMAIN_HOSTNAME}
yq write --inplace config/domains_urls.yaml domains_urls[1].url https://${SECOND_DOMAIN_HOSTNAME}

# Add a mask for trusted proxies so that load balanced traffic is trusted and headers from outside of the network are not lost
yq write --inplace config/parameters.yml parameters.trusted_proxies[+] 10.0.0.0/8
yq write --inplace config/parameters.yaml parameters.trusted_proxies[+] 10.0.0.0/8

cd /tmp/infrastructure/google-cloud

Expand Down
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@
*.xsl text eol=lf
*.xslt text eol=lf
*.yml text eol=lf
*.yaml text eol=lf

composer.lock text eol=lf
2 changes: 1 addition & 1 deletion build/codeception.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ paths:
data: ../tests/App/Acceptance/data
support: ../tests/App/Test/Codeception
params:
- ../config/parameters_test.yml
- ../config/parameters_test.yaml
settings:
colors: true
memory_limit: 1024M
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,11 @@
},
"incenteev-parameters": [
{
"file": "config/parameters.yml",
"file": "config/parameters.yaml",
"keep-outdated": true
},
{
"file": "config/parameters_test.yml",
"file": "config/parameters_test.yaml",
"keep-outdated": true
}
]
Expand Down
8 changes: 4 additions & 4 deletions config/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
domains_urls.yml
parameters.yml
parameters_test.yml
parameters_version.yml
domains_urls.yaml
parameters.yaml
parameters_test.yaml
parameters_version.yaml
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ security:
invalidate_session: false

access_control:
# same pattern must be in routing_front.yml
# same pattern must be in routing_front.yaml
- { path: ^/login-as-remembered-user/$, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/admin/superadmin/, roles: ROLE_SUPER_ADMIN }
- { path: ^/admin/cron/*, roles: ROLE_SUPER_ADMIN }
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
parameters:
shopsys.router.locale_router_filepath_mask: '%shopsys.root_dir%/config/shopsys-routing/routing_front_*.yml'
shopsys.router.friendly_url_router_filepath: '%shopsys.root_dir%/config/shopsys-routing/routing_friendly_url.yml'
shopsys.router.locale_router_filepath_mask: '%shopsys.root_dir%/config/shopsys-routing/routing_front_*.yaml'
shopsys.router.friendly_url_router_filepath: '%shopsys.root_dir%/config/shopsys-routing/routing_friendly_url.yaml'
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions config/paths.yml → config/paths.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ parameters:
shopsys.css_version_filepath: '%shopsys.web_dir%/assets/cssVersion'
shopsys.data_fixtures.resources_dir: '%shopsys.root_dir%/src/DataFixtures/resources'
shopsys.default_db_schema_filepath: '%shopsys.framework.resources_dir%/database/schema.sql'
shopsys.domain_config_filepath: '%shopsys.root_dir%/config/domains.yml'
shopsys.domain_config_filepath: '%shopsys.root_dir%/config/domains.yaml'
shopsys.domain_images_dir: '/web%shopsys.domain_images_url_prefix%'
shopsys.domain_images_url_prefix: '/%shopsys.content_dir_name%/admin/images/domain'
shopsys.domain_urls_config_filepath: '%shopsys.root_dir%/config/domains_urls.yml'
shopsys.domain_urls_config_filepath: '%shopsys.root_dir%/config/domains_urls.yaml'
shopsys.error_pages_dir: '%shopsys.root_dir%/var/errorPages/'
shopsys.feed_dir: '/web%shopsys.feed_url_prefix%'
shopsys.feed_url_prefix: '/%shopsys.content_dir_name%/feeds/'
shopsys.filemanager_upload_dir: '%shopsys.web_dir%/%shopsys.filemanager_upload_web_dir%'
shopsys.filemanager_upload_web_dir: '%shopsys.content_dir_name%/wysiwyg'
shopsys.framework.root_dir: '%shopsys.root_dir%/vendor/shopsys/framework'
shopsys.front_design_image_url_prefix: /public/frontend/images/
shopsys.image_config_filepath: '%shopsys.root_dir%/config/images.yml'
shopsys.image_config_filepath: '%shopsys.root_dir%/config/images.yaml'
shopsys.image_dir: '/web%shopsys.image_url_prefix%'
shopsys.image_url_prefix: '/%shopsys.content_dir_name%/images/'
shopsys.javascript_sources_dir: '%shopsys.resources_dir%/scripts'
Expand All @@ -24,7 +24,7 @@ parameters:
shopsys.root_dir: '%kernel.root_dir%/..'
shopsys.sitemaps_dir: '/web%shopsys.sitemaps_url_prefix%'
shopsys.sitemaps_url_prefix: '/%shopsys.content_dir_name%/sitemaps'
shopsys.uploaded_file_config_filepath: '%shopsys.root_dir%/config/uploaded_files.yml'
shopsys.uploaded_file_config_filepath: '%shopsys.root_dir%/config/uploaded_files.yaml'
shopsys.uploaded_file_dir: '/web%shopsys.uploaded_file_url_prefix%'
shopsys.uploaded_file_url_prefix: '/%shopsys.content_dir_name%/uploadedFiles/'
shopsys.web_dir: '%shopsys.root_dir%/web'
Expand Down
2 changes: 1 addition & 1 deletion config/routes/dev/frontend-api-graphiql.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
shopsys_frontend_api_graphiql:
resource: "@ShopsysFrontendApiBundle/Resources/config/routing_dev.yml"
resource: "@ShopsysFrontendApiBundle/Resources/config/routing_dev.yaml"
prefix: /graphql
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
shopsys_frontend_api:
resource: "@ShopsysFrontendApiBundle/Resources/config/routing.yml"
resource: "@ShopsysFrontendApiBundle/Resources/config/routing.yaml"
prefix: /graphql
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
shopsys_framework:
resource: "@ShopsysFrameworkBundle/Resources/config/routing.yml"
resource: "@ShopsysFrameworkBundle/Resources/config/routing.yaml"
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ front_contact_form_send:
condition: "request.isXmlHttpRequest()"

front_customer_login_as_remembered_user:
# same path must be in security.yml
# same path must be in security.yaml
path: /login-as-remembered-user/
defaults:
_controller: App\Controller\Front\CustomerController:loginAsRememberedUserAction
Expand Down
File renamed without changes.
12 changes: 6 additions & 6 deletions config/services.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
imports:
- { resource: forms.yml }
- { resource: services/*.yml }
- { resource: paths.yml }
- { resource: parameters_common.yml }
- { resource: parameters.yml }
- { resource: directories.yml }
- { resource: forms.yaml }
- { resource: services/*.yaml }
- { resource: paths.yaml }
- { resource: parameters_common.yaml }
- { resource: parameters.yaml }
- { resource: directories.yaml }

services:
_defaults:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion config/services_test.yml → config/services_test.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
imports:
- { resource: parameters_test.yml }
- { resource: parameters_test.yaml }

framework:
test: true
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion docker/nginx/google-cloud/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ server {

location ~ ^/content(-test)?/images/ {
# Newly uploaded images get new ID (different URL) so they could be cached forever.
# But change of resolution in images.yml does not induce a change of URL
# But change of resolution in images.yaml does not induce a change of URL
# so it is safer to cache generated images only for few days.
expires 1w;

Expand Down
2 changes: 1 addition & 1 deletion docker/nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ server {

location ~ ^/content(-test)?/images/ {
# Newly uploaded images get new ID (different URL) so they could be cached forever.
# But change of resolution in images.yml does not induce a change of URL
# But change of resolution in images.yaml does not induce a change of URL
# so it is safer to cache generated images only for few days.
expires 1w;

Expand Down
24 changes: 12 additions & 12 deletions kubernetes/deployments/webserver-php-fpm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ spec:
- name: source-codes
mountPath: /tmp/source-codes
- name: domains-urls
mountPath: "{{PATH_CONFIG_DIRECTORY}}/domains_urls.yml"
subPath: domains_urls.yml
mountPath: "{{PATH_CONFIG_DIRECTORY}}/domains_urls.yaml"
subPath: domains_urls.yaml
- name: parameters
mountPath: "{{PATH_CONFIG_DIRECTORY}}/parameters.yml"
subPath: parameters.yml
mountPath: "{{PATH_CONFIG_DIRECTORY}}/parameters.yaml"
subPath: parameters.yaml
- name: initialize-database
image: "{{DOCKER_PHP_FPM_IMAGE}}"
securityContext:
Expand All @@ -66,11 +66,11 @@ spec:
- name: source-codes
mountPath: /var/www/html
- name: domains-urls
mountPath: "{{PATH_CONFIG_DIRECTORY}}/domains_urls.yml"
subPath: domains_urls.yml
mountPath: "{{PATH_CONFIG_DIRECTORY}}/domains_urls.yaml"
subPath: domains_urls.yaml
- name: parameters
mountPath: "{{PATH_CONFIG_DIRECTORY}}/parameters.yml"
subPath: parameters.yml
mountPath: "{{PATH_CONFIG_DIRECTORY}}/parameters.yaml"
subPath: parameters.yaml
env:
- name: GOOGLE_CLOUD_STORAGE_BUCKET_NAME
value: "{{GOOGLE_CLOUD_STORAGE_BUCKET_NAME}}"
Expand All @@ -86,11 +86,11 @@ spec:
- name: source-codes
mountPath: /var/www/html
- name: domains-urls
mountPath: "{{PATH_CONFIG_DIRECTORY}}/domains_urls.yml"
subPath: domains_urls.yml
mountPath: "{{PATH_CONFIG_DIRECTORY}}/domains_urls.yaml"
subPath: domains_urls.yaml
- name: parameters
mountPath: "{{PATH_CONFIG_DIRECTORY}}/parameters.yml"
subPath: parameters.yml
mountPath: "{{PATH_CONFIG_DIRECTORY}}/parameters.yaml"
subPath: parameters.yaml
env:
- name: GOOGLE_CLOUD_STORAGE_BUCKET_NAME
value: "{{GOOGLE_CLOUD_STORAGE_BUCKET_NAME}}"
Expand Down
4 changes: 2 additions & 2 deletions kubernetes/kustomize/base/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ configMapGenerator:
- ../../../docker/postgres/postgres.conf
- name: domains-urls
files:
- ../../../config/domains_urls.yml
- ../../../config/domains_urls.yaml
- name: parameters
files:
- ../../../config/parameters.yml
- ../../../config/parameters.yaml
6 changes: 3 additions & 3 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ if [[ -d "project-base" ]]; then
fi

echo "Creating config files.."
cp -f "${projectPathPrefix}config/parameters.yml.dist" "${projectPathPrefix}config/parameters.yml"
cp -f "${projectPathPrefix}config/parameters_test.yml.dist" "${projectPathPrefix}config/parameters_test.yml"
cp -f "${projectPathPrefix}config/domains_urls.yml.dist" "${projectPathPrefix}config/domains_urls.yml"
cp -f "${projectPathPrefix}config/parameters.yaml.dist" "${projectPathPrefix}config/parameters.yaml"
cp -f "${projectPathPrefix}config/parameters_test.yaml.dist" "${projectPathPrefix}config/parameters_test.yaml"
cp -f "${projectPathPrefix}config/domains_urls.yaml.dist" "${projectPathPrefix}config/domains_urls.yaml"

echo "Creating docker configuration.."
case "$operatingSystem" in
Expand Down
8 changes: 4 additions & 4 deletions src/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ protected function configureContainer(ContainerBuilder $container, LoaderInterfa
$loader->load($confDir . '/{services}' . self::CONFIG_EXTS, 'glob');
$loader->load($confDir . '/{services}_' . $this->environment . self::CONFIG_EXTS, 'glob');

if (file_exists(__DIR__ . '/../../parameters_monorepo.yml')) {
$loader->load(__DIR__ . '/../../parameters_monorepo.yml');
if (file_exists(__DIR__ . '/../../parameters_monorepo.yaml')) {
$loader->load(__DIR__ . '/../../parameters_monorepo.yaml');
}

if (file_exists($confDir . '/parameters_version.yml')) {
$loader->load($confDir . '/parameters_version.yml');
if (file_exists($confDir . '/parameters_version.yaml')) {
$loader->load($confDir . '/parameters_version.yaml');
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ public function testLoadDomainConfigsFromYamlUrlsConfigFileNotFound()

public function testLoadDomainConfigsFromYamlDomainConfigsDoNotMatchException()
{
$domainsConfigFilepath = __DIR__ . '/test_domains.yml';
$domainsUrlsConfigFilepath = __DIR__ . '/test_domains_urls.yml';
$domainsConfigFilepath = __DIR__ . '/test_domains.yaml';
$domainsUrlsConfigFilepath = __DIR__ . '/test_domains_urls.yaml';

$this->expectException(\Shopsys\FrameworkBundle\Component\Domain\Config\Exception\DomainConfigsDoNotMatchException::class);

Expand Down
4 changes: 2 additions & 2 deletions tests/App/Smoke/Http/RouteConfigCustomization.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ private function filterRoutesForTesting(RouteConfigCustomizer $routeConfigCustom
}
})
->customizeByRouteName('admin_access_denied', function (RouteConfig $config) {
$config->changeDefaultRequestDataSet('This route serves as "access_denied_url" (see security.yml) and always redirects to a referer (or dashboard).')
$config->changeDefaultRequestDataSet('This route serves as "access_denied_url" (see security.yaml) and always redirects to a referer (or dashboard).')
->setExpectedStatusCode(302);
});
}
Expand Down Expand Up @@ -289,7 +289,7 @@ private function configureFrontendRoutes(RouteConfigCustomizer $routeConfigCusto
->setExpectedStatusCode(302);
})
->customizeByRouteName('front_logout', function (RouteConfig $config) {
$debugNote = 'Add CSRF token for logout action (configured in config/packages/security.yml) during test execution.';
$debugNote = 'Add CSRF token for logout action (configured in config/packages/security.yaml) during test execution.';
$config->changeDefaultRequestDataSet($debugNote)
->addCallDuringTestExecution(function (RequestDataSet $requestDataSet, ContainerInterface $container) {
/** @var \Symfony\Component\Security\Csrf\CsrfTokenManager $csrfTokenManager */
Expand Down
2 changes: 1 addition & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Encore
]))
;

const domainFile = './config/domains.yml';
const domainFile = './config/domains.yaml';
const domains = yaml.safeLoad(fs.readFileSync(domainFile, 'utf8'));

const domainStylesDirectories = new Set(domains.domains.map(domain => {
Expand Down
4 changes: 2 additions & 2 deletions yaml-standards.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
excludedPaths:
- ./vendor
- ./node_modules
- ./config/domains_urls.yml
- ./config/oauth2/parameters_oauth.yml.dist
- ./config/domains_urls.yaml
- ./config/oauth2/parameters_oauth.yaml.dist
checkers:
- pathToChecker: YamlStandards\Model\YamlIndent\YamlIndentChecker
parameters:
Expand Down

0 comments on commit 0861abc

Please sign in to comment.