Конфигурация
Специфичные для среды конфигурации
Pimcore поддерживает различные конфигурации для разных сред (Dev, тест, этап, Prod, ...), а также пользовательские Конфигурации, включая механизм резерва.
Pimcore полагается на среду Symfony, с некоторыми дополнениями, однако все необходимые Информацию можно найти в {p0}
Note: Require
symfony/dotenvin your project to use Symfony's DotEnv component to allow you to configure environment variables in.envfiles, or (e.g. in prod environments) you can configure everything via real environment variables.
В дополнение к конфигурациям Symfony, Pimcore также поддерживает конкретные конфигурации среды для:
- https://github.com/pimcore/demo/tree/11.x/config/pimcore
- https://github.com/pimcore/demo/tree/11.x/var/config
Места хранилища конфигурации
Для определенных конфигураций, которые можно отредактировать в пользовательском интерфейсе, Pimcore предоставляет возможность настроить их с использованием различных типов хранения. Доступные хранилища (в приоритетном порядке):
- Symfony Config (YAML, требует перестройка контейнеров)
- Pimcore {p2}
Эта функция в настоящее время поддерживается следующими конфигурациями:
- Пользовательские отчеты
- Типы документов
- Изображение миниатюры
- Видео миниатюры
- Настройки Web2print
- Предопределенные свойства
- Предопределенные метаданные актива
- Статические маршруты
- Перспективы
- Пользовательские представления
- DataObject пользовательские макеты
Данные конфигураций загружаются из контейнера, и если нет данных, попробуйте загрузить его с settings-store
Вы можете изменить цель чтения/записи индивидуально для каждого типа, используя конфигурацию Symfony. Доступны следующие варианты:
symfony-config- Написать конфигурации как Symfony Config в качестве файлов YAML в каталог настроенного хранения
settings-store- записать конфигурации в {c7}
disabled(только цель записи)- вообще не позволяйте редактировать/записать конфигурации вообще
каталог хранилища для файлов конфигурации Symfony
Каталог хранилища по умолчанию для файлов конфигурации Symfony определяется PIMCORE_CONFIGURATION_DIRECTORY.
Если нет целевого набора чтения, используется конфигурация цели записи.
Доступные параметры для целей записи и каталогов и целей чтения и каталога для файлов конфигурации Symfony:
pimcore:
config_location:
image_thumbnails:
write_target:
type: 'symfony-config'
options:
directory: '/var/www/html/var/config/image-thumbnails'
video_thumbnails:
write_target:
type: 'disabled'
document_types:
write_target:
type: 'disabled'
predefined_properties:
write_target:
type: 'settings-store'
predefined_asset_metadata:
write_target:
type: 'symfony-config'
options:
directory: '/var/www/html/var/config/predefined_asset_metadata'
perspectives:
write_target:
type: 'symfony-config'
options:
directory: '/var/www/html/var/config/perspectives'
custom_views:
write_target:
type: 'symfony-config'
options:
directory: '/var/www/html/var/config/custom_views'
object_custom_layouts:
write_target:
type: 'symfony-config'
options:
directory: '/var/www/html/var/config/object_custom_layouts'
select_options:
write_target:
type: 'symfony-config'
options:
directory: '/var/www/html/var/config/select_options'
and for some specific optional bundles are:
pimcore_custom_reports:
config_location:
custom_reports:
write_target:
type: 'symfony-config'
pimcore_static_routes:
config_location:
staticroutes:
write_target:
type: 'symfony-config'
...
Production environment with symfony-config
When using symfony-config write target, configs are written to Symfony Config files (yaml), which are only getting revalidated in debug mode. So if you're
changing configs in production, you won't see any update because these configs are read-only.
If you'd like to allow changes in production, switch to the alternate settings-store config storage.
You can do so by adding the following to your symfony-config. e.g.:
pimcore:
config_location:
predefined_properties:
write_target:
type: 'settings-store'
Revalidate existing configuration on production
With settings-store target, one can update/change configurations in production environment, which in turn revalidates the generated files e.g. Image Thumbnails, Video thumbnails for subsequent requests.
This is not the case with symfony-config write target, as configurations are read-only and deployed from different environment. So we need to explicitly revalidate the generated files either through command or custom script.
For example, to revalidate image or video thumbnails either run command pimcore:thumbnails:clear or call Asset\Image\Thumbnail\Config::clearTempFiles() after deploying changes on thumbnail configurations.
Troubleshooting: save button is grayed out
Please note that the saving button would be disabled (grayed out) under the following conditions:
- when
write_targetis intentionally set todisabled - as specified above about production enviroment, when set to
symfony-configand not being in debug mode - when the
write_targetissymfony-configand theyamlfile does not exist, or it is not writeable (according to file-system permissions) - when the
read_targetis set but it does not match with thewrite_target.
Вы можете предложить улучшение документации или задать вопрос в комментариях.
Если вам нужна полноценная консультация — вы можете заказать её на нашем сайте.