Monitor kirby version from another website

Hi,
I’m starting to build a private website to monitor all of my Kirby websites.
I would like to know if there is a simple and secure way to get a website kirby version out of the box, (I suppose no for security reasons). Would building a custom route that returns the Kirby version be considered a recommended approach? Or this idea should be kept in the bad idea bin? haha.

Otherwise I might just fill it manually.
Thanks a lot.

A route could be an option, but it shouldn’t be openly accessible, so you would have to add authentication of some sort, e.g., token-based.

Doesn’t feel like a very simple option, but you are right — I’m also thinking about looking into the composer.lock.

It is not very difficult:

  1. In the Kirby project you want to query, define a token in config

  2. Inside the route, you check if the request contains the token as query param, if true, you return the result, otherwise an error

    if (!empty($token = get('token')) && $token === option('token')) {
        // return result
    }
    
  3. In your monitoring app, when querying the route from the remote Kirby installation, you send the token as query param in your request, example:

    $request = Remote::get(
        option('projectAUrl') . '?token=' .
        option('keys.projectAToken')	);
    

Maybe not worth the effort just for the Kirby version, but in case you also want to get other information from your Kirby installations.

That’s it.

2 Likes

Thanks a lot Sonia.
Have a nice week-end.