Skip to content

Commit

Permalink
Merge branch 'master' into 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
butschster committed Aug 30, 2022
2 parents 6ec8d95 + 3f6b74a commit 739d086
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ jobs:
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Restore Composer Cache
uses: actions/[email protected].5
uses: actions/[email protected].8
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-${{ matrix.php }}-${{ matrix.stability }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-${{ matrix.php }}-${{ matrix.stability }}-composer

- name: Install Dependencies
uses: nick-invision/retry@v2.7.0
uses: nick-invision/retry@v2.8.1
with:
timeout_minutes: 5
max_attempts: 5
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ jobs:
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Restore Composer Cache
uses: actions/[email protected].5
uses: actions/[email protected].8
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-${{ matrix.php }}-composer

- name: Install Dependencies
uses: nick-invision/retry@v2.7.0
uses: nick-invision/retry@v2.8.1
with:
timeout_minutes: 5
max_attempts: 5
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ class PingController
{
public function ping(StoreRequest $request, PingSiteHandler $handler): void
{
$this->hanlder->handle(
$this->handler->handle(
$request->url,
$request->name
);
Expand Down
4 changes: 3 additions & 1 deletion src/Bootloader/TemporalBridgeBootloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
use Spiral\TemporalBridge\WorkflowPresetLocator;
use Spiral\TemporalBridge\WorkflowPresetLocatorInterface;
use Spiral\Tokenizer\ClassesInterface;
use Temporal\Client\ClientOptions;
use Temporal\Client\GRPC\ServiceClient;
use Temporal\Client\WorkflowClient;
use Temporal\Client\WorkflowClientInterface;
Expand Down Expand Up @@ -108,7 +109,8 @@ private function initConfig(EnvironmentInterface $env): void
private function initWorkflowClient(TemporalConfig $config): WorkflowClientInterface
{
return WorkflowClient::create(
ServiceClient::create($config->getAddress())
ServiceClient::create($config->getAddress()),
(new ClientOptions())->withNamespace($config->getTemporalNamespace()),
);
}

Expand Down
6 changes: 6 additions & 0 deletions src/Config/TemporalConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ final class TemporalConfig extends InjectableConfig
protected array $config = [
'address' => null,
'namespace' => null,
'temporalNamespace' => null,
'defaultWorker' => WorkerFactoryInterface::DEFAULT_TASK_QUEUE,
'workers' => [],
];
Expand All @@ -23,6 +24,11 @@ public function getDefaultNamespace(): string
return $this->config['namespace'] ?? 'App\\Workflow';
}

public function getTemporalNamespace(): string
{
return $this->config['temporalNamespace'] ?? 'default';
}

public function getAddress(): string
{
return $this->config['address'] ?? 'localhost:7233';
Expand Down
16 changes: 16 additions & 0 deletions tests/src/Config/TemporalConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,22 @@ public function testGetsDefaultNamespaceIfItNotSet(): void
$this->assertSame('App\\Workflow', $config->getDefaultNamespace());
}

public function testGetsDefaultTemporalNamespaceIfItNotSet(): void
{
$config = new TemporalConfig([]);

$this->assertSame('default', $config->getTemporalNamespace());
}

public function testGetsDefaultTemporalNamespace(): void
{
$config = new TemporalConfig([
'temporalNamespace' => 'foo',
]);

$this->assertSame('foo', $config->getTemporalNamespace());
}

public function testGetsAddress(): void
{
$config = new TemporalConfig([
Expand Down

0 comments on commit 739d086

Please sign in to comment.