platformsh / symfonyflex-bridge

Bridge library for running Symfony Flex on Platform.sh
MIT License
30 stars 15 forks source link

Remove dependency on `rel` property #45

Closed matthiaz closed 3 years ago

matthiaz commented 3 years ago

Solr relationships don't always have a rel property.

Documentation does mention that it looks like this: Relationship

The format exposed in the $PLATFORM_RELATIONSHIPS environment variable:

{
    "service": "solr86",
    "ip": "169.254.251.226",
    "hostname": "csjsvtdhmjrdre2uaoeim22xjy.solr86.service._.eu-3.platformsh.site",
    "cluster": "rjify4yjcwxaa-master-7rqtwti",
    "host": "solr.internal",
    "rel": "solr",
    "path": "solr\/maincore",
    "scheme": "solr",
    "type": "solr:8.6",
    "port": 8080
}

But sometimes it looks like this:

   "solr" : [
      {
         "port" : "8983",
         "path" : "solr/wb",
         "host" : "localhost",
         "scheme" : "solr"
      }
   ],

So lets check if 'rel' actually exists first. if it does not, extract the CORE from the path.

This is actually mentioned in the documentation https://docs.platform.sh/configuration/services/solr.html#solr-6-and-later but it also seems that way on dedicated instances.