Dynamic domain names for dynamic blueprint select fields

Hi,

i use the feature of the json api in combination with select fields in blueprints. I wonder how i can define URLs for my test system and for the live system. I don´t want to change it all the time when i update my blueprint:


fields:
  linkedpage:
    label: Linked Page
    type: select
    options: >
      http://my-test-system.de/api/query:pages

Now on the live system i have the domain http://my-live-system.de. How can i implement my test system domain and my live system domain in the blueprint?

Is there a way to do that like the config.php:

# test system
my-test-system.de.config.php
# live system
my-live-system.de.config.php

Or other solutions?

Couldn’t you just use relative URLs instead? Something like /api/query:pages in your case …

if you need an absolute URL you may try

echo $site->url() . "api/query:pages";

@tobiasweh You cannot echo anything in your blueprint, it’s just a yaml file.

And I don’t think you can use a relative url, either, i guess it will not validate.

One option/idea may be to write your own custom field, extending the default select field.

In your custom field code, you could check for a config value, then load the appropriate domain based on that. Or check the server name. (I’d probably use a config value, though.)

2 Likes

Ah … I thougt the URL from the field should be used in a template. didn’t get that it is a query for the select field