getkirby / cli

Kirby Command Line Interface
MIT License
51 stars 5 forks source link

CLI commands always use `_` cache, not the current domain caches #51

Closed tobimori closed 10 months ago

tobimori commented 10 months ago

Let's say my UUID cache is in site/cache/domain.com/uuid - and and repopulate the uuids on depoy. I'd run the command kirby uuid:populate - and this now creates the folder site/cache/_/uuid and my correct UUID cache in site/cache/domain.com/uuid ist still the old one.

This spans accross all commands and makes the CLI mostly unusuable for me right now.

Might be related to #38

lukasbestle commented 10 months ago

@distantnative Has the uuid:populate command worked in the past? I wonder how it was ever able to retrieve the domain.

Unless I'm missing something, I think this indeed needs #38.

bnomei commented 10 months ago

yeah is kirbys name for localhost which is the env you get on cli. you can create a config/config..php and set the cache root to whatever folder you need.

lukasbestle commented 10 months ago

Good point. With 3.9.8 we will also have a separate CLI config (https://github.com/getkirby/kirby/pull/5581), but using it or the _ config file to set the cache root still feels like a hack TBH.

adamkiss commented 10 months ago

I think related to this is: https://github.com/getkirby/cli/issues/38

Surprised me pretty good couple of times; EDIT: I also realised Tobi mentioned #38

lukaskleinschmidt commented 10 months ago

If you are not running a multisite/multi domain setup where you actually need or want to have separate caches you can also make the caches environment independet by setting the prefix for the specific caches.

<?php

return [
    'cache' => [
        'pages' => [
            'prefix' => 'pages',
            'active' => true,
            'type'   => 'file',
        ],
        'uuid' => [
            'prefix' => 'uuid',
            'active' => true,
        ],
        'default' => [
            'prefix' => 'default',
            'active' => true,
        ],
    ],
];
bnomei commented 10 months ago

@lukaskleinschmidt so setting the prefix overwrites kirby applying a domain? nice.

bnomei commented 10 months ago

@lukaskleinschmidt so setting the prefix overwrites kirby applying a domain? nice.

lukaskleinschmidt commented 10 months ago

Yes. You can actually also set it to null which will dump everything in the cache root. But I guess having at least the uuid or pages prefix is probably what you want at least.

bastianallgeier commented 10 months ago

I don't think there's a good reliable way for us to find out which domain to use from the CLI. The combination of the new cli config and @lukaskleinschmidt's suggestions seem like a good solution and I will close this. Please tell me if I missed something and we can reopen it.