@ligonsker This might help you.
$env = config('app.env');
return [
'disks' => [
'my_disk' => [
'driver' => 'local',
'root' => "\some_network_location\$env\my_disk",
]
]
];
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello,
If I have 2 different network filesystem disk paths for prod and test, how would you configure it?
For example, the test path is \\some_network_location\test\my_disk, and the prod path is \\some_network_location\test\my_disk, should my /config/filesystems.php file look like this:
switch (config('app.env')) {
case ('prod'):
return [
'disks' => [
'my_disk' => [
'driver' => 'local',
'root' => '\\some_network_location\prod\my_disk',
]
]
];
break;
case ('test'):
return [
'disks' => [
'my_disk' => [
'driver' => 'local',
'root' => '\\some_network_location\test\my_disk',
]
]
];
break;
}
or a different way? In the above way the file would basically be a copy of the same values just swapping the word "test" with "prod" everywhere. But maybe there's a more elegant way?
Thanks
don't you have a different env file for tests? or are you talking about a test installation.
If you have a test installation then it should be done through the env file
If you put logic like you proposed in a config file, it can no longer be cached
I would;
'disks' => [
'my_disk' => [
'driver' => 'local',
'root' => env('LOCAL_DISK_PATH', '\some_network_location\prod\my_disk'),
]
]
and then on test installation, the env file can contain
LOCAL_DISK_PATH= '\some_network_location\test\my_disk',
Please or to participate in this conversation.