Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
- [ ] CHANGELOG.md updated under `[Unreleased]`
- [ ] No command is built as a string; commands stay arrays
- [ ] Any secret the package injects is registered with the `Redactor`
- [ ] `env()` is still called only in `config/python.php`
- [ ] `env()` is still called only in `config/polyglot.php`
- [ ] Security-relevant behaviour has a test that fails without the fix
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ clean before a PR.
- **Never build a command string.** Commands are arrays, which bypass the shell.
An architecture test asserts `shell_exec`, `exec`, `passthru`, `system`,
`proc_open` and `popen` appear nowhere in the package.
- **`env()` is called in `config/python.php` and nowhere else.** Anywhere else
- **`env()` is called in `config/polyglot.php` and nowhere else.** Anywhere else
it returns null the moment the host runs `config:cache`. Also asserted.
- **A secret the package injects must be registered with the `Redactor`.** If it
can reach stderr or an exception message, it will.
Expand Down
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,20 @@ composer require laranail/polyglot
php artisan laranail::polyglot.install
```

## Quick start
## Quick start guide and usage

### Getting started

1. `php artisan laranail::polyglot.install` (see Install) publishes the config and prints what is left.
2. Point a service at its URL in `.env`. The default service is `fastapi`:

```dotenv
POLYGLOT_FASTAPI_URL=http://127.0.0.1:8000
```

3. Only HTTP services are on by default. Local scripts stay off until `POLYGLOT_PROCESS_ENABLED=true` (it is code execution), and callbacks stay off until `POLYGLOT_CALLBACKS_ENABLED=true` and `POLYGLOT_CALLBACK_SECRET` is set.

### Usage

```php
use Simtabi\Laranail\Polyglot\Facades\Polyglot;
Expand Down
2 changes: 1 addition & 1 deletion docs/configuration.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Configuration

Everything in `config/python.php`, published by `php artisan laranail::polyglot.install`. Keys live under
Everything in `config/laranail/polyglot.php`, published by `php artisan laranail::polyglot.install`. Keys live under
`laranail.polyglot.*`.

Three of these blocks are security boundaries rather than preferences — `process`, `callbacks`, and
Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Point a service at a URL:

```php
// config/laranail/python.php
// config/laranail/polyglot.php
'services' => [
'fastapi' => ['base_url' => env('POLYGLOT_FASTAPI_URL', 'http://127.0.0.1:8000')],
],
Expand Down
6 changes: 3 additions & 3 deletions docs/installation.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Installation

```bash
composer require laranail/python
composer require laranail/polyglot
```

The service provider and the `Polyglot` facade are auto-discovered.
Expand All @@ -10,7 +10,7 @@ The service provider and the `Polyglot` facade are auto-discovered.
php artisan laranail::polyglot.install
```

That publishes `config/laranail/python.php` and prints what to do next.
That publishes `config/laranail/polyglot.php` and prints what to do next.

## Requirements

Expand All @@ -32,7 +32,7 @@ does not read a dependency's own `repositories`:
```json
{
"repositories": [
{ "type": "vcs", "url": "https://github.com/laranail/python" },
{ "type": "vcs", "url": "https://github.com/laranail/polyglot" },
{ "type": "vcs", "url": "https://github.com/laranail/console" },
{ "type": "vcs", "url": "https://github.com/laranail/package-tools" }
]
Expand Down
4 changes: 2 additions & 2 deletions docs/release.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Release process

`laranail/python` is released **tag-driven**: pushing a `vX.Y.Z` tag runs the release workflow, which
`laranail/polyglot` is released **tag-driven**: pushing a `vX.Y.Z` tag runs the release workflow, which
publishes the GitHub Release with the CHANGELOG section as its body.

`laranail/*` packages resolve through **git VCS repositories rather than Packagist**, so the tag is the
Expand All @@ -20,7 +20,7 @@ tag per the laranail convention.
- `ValueObjects\{Call, CallResult, ProcessCall, ResolvedCommand}` and the shipped enums.
- The `Exceptions\*` hierarchy and its codes.
- `Testing\PolyglotFake` and its assertions.
- `config/python.php` key shapes and the `POLYGLOT_*` env var names.
- `config/polyglot.php` key shapes and the `POLYGLOT_*` env var names.
- The `laranail::polyglot.{doctor,health,run,install,make-service}` command signatures.
- **The callback wire format** — the signed string, the header names, and the HMAC construction. A
change here breaks every deployed Python service at once, and they do not upgrade in lockstep with
Expand Down
2 changes: 1 addition & 1 deletion docs/tools/callbacks.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ it on — see [architecture](../architecture.md) for why absent beats guarded.
## Enabling it

```php
// config/laranail/python.php
// config/laranail/polyglot.php
'callbacks' => [
'enabled' => true,
'prefix' => 'api/polyglot',
Expand Down
4 changes: 2 additions & 2 deletions src/Commands/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ final class InstallCommand extends Command

protected $name = 'laranail::polyglot.install';

protected $description = 'Publish the laranail/python configuration.';
protected $description = 'Publish the laranail/polyglot configuration.';

public function handle(): int
{
$this->callSilently('vendor:publish', ['--tag' => 'laranail::polyglot-config']);

$display = $this->services->display();
$display->success('Published config/laranail/python.php.');
$display->success('Published config/laranail/polyglot.php.');

$display->list([
'Point laranail.polyglot.services.* at your services, and set an auth scheme if they need one.',
Expand Down
Loading