Closed nmeirik closed 6 years ago
Does Symfony 4 Flex have a standard naming pattern for Elasticsearch env vars? I'm not aware of one, the way there is for Doctrine.
If there is one please point me at it, as I agree it would be very useful to include.
Does Symfony 4 Flex have a standard naming pattern for Elasticsearch env vars
I do not believe it does, so I guess you are free to make the names up so long as they are documented.
Yeah, that's where it's problematic. We would need to know what standard/common names to map the relationship to. Without that it's not much use.
If Symfony standardizes the credential names for Elasticsearch, or Redis, or Solr, or anything else, let us know and we can add it to the package. (Or better yet, PRs welcome!)
Without that it's not much use.
I humbly disagree. The use would be that using https://github.com/platformsh/symfonyflex-bridge would be sufficient to configure the application in Platform.sh. Without environment variables, custom configuration files (commonly named parameters_platform.php
) would have to be included in Symfony 4 as well in order to make the proper environment settings available to the ElasticSearch config.
However, if your decision is firm not to introduce environment variables that do not already have common names in the Symfony community, would you consider adding a parameters_platform.php
or similar to https://github.com/platformsh/template-symfony4 as this would presumably still be necessary in some cases?
The problem is, what do we map them do? For Doctrine DB, we know that we can map the env vars to DATABASE_URL
. We could extract the elasticsearch information from the relationships array easily, but what env vars would they get set to? A single or multiple? If we set it to something that is not what the configuration is expecting, it may as well not be set at all.
The new Laravel bridge library sets a lot more things than the Symfony Flex one does, because Laravel pre-defines environment variables for using a Redis cache or session handler, for instance. Symfony, as far as I'm aware, does not. If it does, please tell me so I can add it. :smile:
I'm not sure where to add a parameters_platform.php
equivalent in Flex, honestly. It doesn't seem to have a place to put that the way Symfony 3 did. Am I missing it?
The alternative I'm aware of is to simply define your own autoload file in your application; that's guaranteed to run pre-config, and you can do whatever env var manipulation you want there. That's really all this library is doing.
I'm not sure where to add a parameters_platform.php equivalent in Flex, honestly. It doesn't seem to have a place to put that the way Symfony 3 did. Am I missing it?
It seems like it would be similar to the behavior i Symfony 3, meaning it could be put where ever in config/
and then imported from a file that's already loaded (like ´config/services.yaml`). Reference. https://symfony.com/doc/current/service_container/import.html
It would be great to have something similar to the database mapping relationship, but for elasticsearch, setting the host, scheme and port into environment variables. The purpose is to avoid implementing the code in https://docs.platform.sh/configuration/services/elasticsearch.html#usage-example