mirror of
https://github.com/shlinkio/shlink.git
synced 2025-02-27 12:49:02 +03:00
Load dev env vars via roadrunner instead of docker compose
This commit is contained in:
parent
c8e5196aab
commit
c0200317dd
3 changed files with 22 additions and 23 deletions
|
@ -74,4 +74,4 @@ CMD \
|
||||||
# Download roadrunner binary
|
# Download roadrunner binary
|
||||||
if [[ ! -f "./bin/rr" ]]; then ./vendor/bin/rr get --no-interaction --no-config --location bin/ && chmod +x bin/rr ; fi && \
|
if [[ ! -f "./bin/rr" ]]; then ./vendor/bin/rr get --no-interaction --no-config --location bin/ && chmod +x bin/rr ; fi && \
|
||||||
# Run with `exec` so that signals are properly handled
|
# Run with `exec` so that signals are properly handled
|
||||||
exec ./bin/rr serve -c config/roadrunner/.rr.dev.yml
|
exec ./bin/rr serve --dotenv /home/shlink/shlink-dev.env -c config/roadrunner/.rr.dev.yml
|
||||||
|
|
|
@ -63,9 +63,6 @@ services:
|
||||||
- shlink_matomo
|
- shlink_matomo
|
||||||
environment:
|
environment:
|
||||||
DEFAULT_DOMAIN: localhost:8800
|
DEFAULT_DOMAIN: localhost:8800
|
||||||
env_file:
|
|
||||||
- path: shlink-dev.env
|
|
||||||
required: false
|
|
||||||
extra_hosts:
|
extra_hosts:
|
||||||
- 'host.docker.internal:host-gateway'
|
- 'host.docker.internal:host-gateway'
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,11 @@ namespace ShlinkioTest\Shlink\Core\Config\PostProcessor;
|
||||||
use PHPUnit\Framework\Attributes\DataProvider;
|
use PHPUnit\Framework\Attributes\DataProvider;
|
||||||
use PHPUnit\Framework\Attributes\Test;
|
use PHPUnit\Framework\Attributes\Test;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
use Shlinkio\Shlink\Core\Config\EnvVars;
|
||||||
use Shlinkio\Shlink\Core\Config\PostProcessor\MultiSegmentSlugProcessor;
|
use Shlinkio\Shlink\Core\Config\PostProcessor\MultiSegmentSlugProcessor;
|
||||||
|
|
||||||
|
use function putenv;
|
||||||
|
|
||||||
class MultiSegmentSlugProcessorTest extends TestCase
|
class MultiSegmentSlugProcessorTest extends TestCase
|
||||||
{
|
{
|
||||||
private MultiSegmentSlugProcessor $processor;
|
private MultiSegmentSlugProcessor $processor;
|
||||||
|
@ -18,37 +21,36 @@ class MultiSegmentSlugProcessorTest extends TestCase
|
||||||
$this->processor = new MultiSegmentSlugProcessor();
|
$this->processor = new MultiSegmentSlugProcessor();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[Test, DataProvider('provideConfigs')]
|
protected function tearDown(): void
|
||||||
public function parsesRoutesAsExpected(array $config, array $expectedRoutes): void
|
|
||||||
{
|
{
|
||||||
self::assertEquals($expectedRoutes, ($this->processor)($config)['routes'] ?? []);
|
putenv(EnvVars::MULTI_SEGMENT_SLUGS_ENABLED->value);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[Test, DataProvider('provideConfigs')]
|
||||||
|
public function parsesRoutesAsExpected(bool $multiSegmentEnabled, array $routes, array $expectedRoutes): void
|
||||||
|
{
|
||||||
|
putenv(EnvVars::MULTI_SEGMENT_SLUGS_ENABLED->value . '=' . ($multiSegmentEnabled ? 'true' : 'false'));
|
||||||
|
self::assertEquals($expectedRoutes, ($this->processor)(['routes' => $routes])['routes'] ?? []);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function provideConfigs(): iterable
|
public static function provideConfigs(): iterable
|
||||||
{
|
{
|
||||||
yield [[], []];
|
|
||||||
yield [['url_shortener' => []], []];
|
|
||||||
yield [['url_shortener' => ['multi_segment_slugs_enabled' => false]], []];
|
|
||||||
yield [
|
yield [
|
||||||
[
|
false,
|
||||||
'url_shortener' => ['multi_segment_slugs_enabled' => false],
|
$routes = [
|
||||||
'routes' => $routes = [
|
|
||||||
['path' => '/foo'],
|
['path' => '/foo'],
|
||||||
['path' => '/bar/{shortCode}'],
|
['path' => '/bar/{shortCode}'],
|
||||||
['path' => '/baz/{shortCode}/foo'],
|
['path' => '/baz/{shortCode}/foo'],
|
||||||
],
|
],
|
||||||
],
|
|
||||||
$routes,
|
$routes,
|
||||||
];
|
];
|
||||||
yield [
|
yield [
|
||||||
|
true,
|
||||||
[
|
[
|
||||||
'url_shortener' => ['multi_segment_slugs_enabled' => true],
|
|
||||||
'routes' => [
|
|
||||||
['path' => '/foo'],
|
['path' => '/foo'],
|
||||||
['path' => '/bar/{shortCode}'],
|
['path' => '/bar/{shortCode}'],
|
||||||
['path' => '/baz/{shortCode}/foo'],
|
['path' => '/baz/{shortCode}/foo'],
|
||||||
],
|
],
|
||||||
],
|
|
||||||
[
|
[
|
||||||
['path' => '/foo'],
|
['path' => '/foo'],
|
||||||
['path' => '/bar/{shortCode:.+}'],
|
['path' => '/bar/{shortCode:.+}'],
|
||||||
|
|
Loading…
Add table
Reference in a new issue