signifly / laravel-kubernetes
Integration helpers for running services in Kubernetes
Installs: 4 293
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 3
Forks: 0
Open Issues: 0
Requires
- php: >=7.4 | ^8.0
- fideloper/proxy: ^4.4
- illuminate/contracts: ^8.0
Requires (Dev)
- orchestra/testbench: ^6.0
- phpunit/phpunit: ^9.3
- signifly/php-config: dev-master
- vimeo/psalm: ^3.11
This package is auto-updated.
Last update: 2024-04-09 18:11:58 UTC
README
This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.
TODO
- Configurable liveness / readiness endpoints
- Configurable liveness / readiness commands
- Login / create user via
X-Forwarded-User
- Trust proxies
Installation
You can install the package via composer:
composer require signifly/laravel-kubernetes
You can publish and run the migrations with:
php artisan vendor:publish --provider="Signifly\Kubernetes\KubernetesServiceProvider" --tag="migrations" php artisan migrate
You can publish the config file with:
php artisan vendor:publish --provider="Signifly\Kubernetes\KubernetesServiceProvider" --tag="config"
This is the contents of the published config file:
return [
];
Initiate the integration by running;
php artisan kubernetes:install
This will automatically set up and inject the Http middleware needed for the integration to work.
Usage
You can provide a check callback, that's used when checking if the request is authenticated.
Kubernetes::useCheck(function ($request, $next) { return $request->ip() === '127.0.0.1'; });
The default check just calls Auth::check()
.
You should provide a login callback that logs in the user, given an email, and decices how to further process the request.
For example, redirecting back to the previous url;
Kubernetes::useLogin(function ($email) { Auth::login(User::firstOrCreate(['email' => $email])); return redirect()->intended(); });
or, just continuing the middleware chain;
Kubernetes::useLogin(function ($email, $request, $next) { Auth::login(User::firstOrCreate(['email' => $email])); return $next($request); });
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.