-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
911 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
name: "Run TODO to Issue" | ||
on: ["push"] | ||
jobs: | ||
build: | ||
runs-on: "ubuntu-latest" | ||
steps: | ||
- uses: "actions/checkout@v3" | ||
- name: "TODO to Issue" | ||
uses: "alstr/todo-to-issue-action@v4" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
.DS_Store | ||
.env | ||
.idea | ||
.tmp | ||
composer.lock | ||
composer.phar | ||
coverage | ||
public/assets/node_modules/** | ||
public/assets/cache/** | ||
phinx.yml | ||
vendor/ | ||
yarn.lock | ||
yarn-error.log | ||
*~ | ||
*.mo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
{ | ||
"name": "vaizard/glued-if-fio_cz", | ||
"description": "fio.cz glued integration.", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Pavel Stratil", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"require": { | ||
"php": "^8.2", | ||
"ext-apcu": "*", | ||
"ext-bcmath": "*", | ||
"ext-curl": "*", | ||
"ext-gd": "*", | ||
"ext-gmp": "*", | ||
"ext-imap": "*", | ||
"ext-json": "*", | ||
"ext-mbstring": "*", | ||
"ext-mysqli": "*", | ||
"ext-readline": "*", | ||
"ext-soap": "*", | ||
"ext-xml": "*", | ||
"grasmash/yaml-expander": "^3", | ||
"league/flysystem": "^3", | ||
"monolog/monolog": "^3", | ||
"nyholm/psr7": "^1", | ||
"nyholm/psr7-server": "*", | ||
"opis/json-schema": "^2", | ||
"php-di/php-di": "^7", | ||
"phpfastcache/phpfastcache": "^9", | ||
"ramsey/uuid": "^4", | ||
"sabre/event": "^6", | ||
"selective/transformer": "^1.3", | ||
"slim/http": "^1", | ||
"slim/slim": "^4", | ||
"symfony/yaml": "^6", | ||
"vaizard/glued-lib": "dev-main", | ||
"zeuxisoo/slim-whoops": "^0.7", | ||
"symfony/browser-kit": "^7.0", | ||
"galbar/jsonpath": "^3.0", | ||
"globalcitizen/php-iban": "^4.2" | ||
}, | ||
"require-dev": { | ||
"ergebnis/composer-normalize": "^2" | ||
}, | ||
"suggest": { | ||
"ext-xdebug": "For dev only" | ||
}, | ||
"minimum-stability": "beta", | ||
"prefer-stable": true, | ||
"autoload": { | ||
"psr-4": { | ||
"Glued\\": "glued/", | ||
"PHP_IBAN\\": "vendor/globalcitizen/php-iban/" | ||
}, | ||
"files": [] | ||
}, | ||
"config": { | ||
"allow-plugins": { | ||
"ergebnis/composer-normalize": true | ||
} | ||
}, | ||
"scripts": { | ||
"post-install-cmd": [ | ||
"composer configure || echo \"[FAIL] Failed to configure glued. Please make sure all env variables are set. Rerun composer configure.\"", | ||
"composer migrate", | ||
"echo \"Run 'composer nginx' manually to pick restart this microservice\"" | ||
], | ||
"post-update-cmd": [ | ||
"composer migrate", | ||
"composer configure || echo \"[FAIL] Failed to configure glued. Please make sure all env variables are set. Rerun composer configure.\"", | ||
"echo \"Run 'composer nginx' manually to pick restart this microservice\"" | ||
], | ||
"backup": [ | ||
"vendor/vaizard/glued-lib/src/Scripts/backup.sh" | ||
], | ||
"configure": [ | ||
"vendor/vaizard/glued-lib/src/Scripts/initpaths.sh", | ||
"Glued\\Lib\\ComposerHooks::configTool", | ||
"vendor/vaizard/glued-lib/src/Scripts/cacheroutes.sh" | ||
], | ||
"migrate": [ | ||
"vendor/vaizard/glued-lib/src/Scripts/migrate.sh" | ||
], | ||
"nginx": [ | ||
"patch -s --reject-file=/dev/null -p1 vendor/monolog/monolog/src/Monolog/Logger.php < vendor/vaizard/glued-lib/src/Patches/Logger.patch", | ||
"vendor/vaizard/glued-lib/src/Scripts/nginx.sh", | ||
"Glued\\Lib\\ComposerHooks::generateNginx", | ||
"vendor/vaizard/glued-lib/src/Scripts/nginx-reload.sh", | ||
"vendor/vaizard/glued-lib/src/Scripts/php-fpm.sh", | ||
"Glued\\Lib\\ComposerHooks::generatePHPFPM", | ||
"vendor/vaizard/glued-lib/src/Scripts/php-fpm-reload.sh", | ||
"patch -Rs --reject-file=/dev/null -p1 vendor/monolog/monolog/src/Monolog/Logger.php < vendor/vaizard/glued-lib/src/Patches/Logger.patch" | ||
], | ||
"settings": [ | ||
"Glued\\Lib\\ComposerHooks::PrintSettings" | ||
], | ||
"start": "php -S localhost:8080 -t public" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
-- migrate:up | ||
|
||
INSERT INTO `t_if__services` (`c_uuid`, `c_data`) | ||
VALUES (uuid_to_bin("a3d3e577-b2d3-45af-b2c3-e6cb32e49903", true), '{"remote": "https://fio.cz", "service": "fio_cz", "deployment": "fio.cz"}') | ||
ON DUPLICATE KEY UPDATE `c_data` = VALUES(`c_data`); | ||
|
||
-- migrate:down | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
## | ||
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples. | ||
## | ||
|
||
server { | ||
########################## | ||
# Server setup # | ||
########################## | ||
|
||
root /var/www/html/glued-if-fio_cz/public; | ||
listen 8017 ssl default_server; | ||
listen [::]:8017 ssl default_server; | ||
http2 on; | ||
include snippets/server/common.conf; | ||
|
||
########################## | ||
# Path locations # | ||
########################## | ||
|
||
# Main locations | ||
include snippets/common/location-main.conf; | ||
|
||
########################## | ||
# PHP location match # | ||
########################## | ||
|
||
include snippets/common/location-php.conf; | ||
|
||
########################## | ||
# Exact locations # | ||
########################## | ||
|
||
# none | ||
|
||
########################## | ||
# Deny location match # | ||
########################## | ||
|
||
include snippets/common/location-deny.conf; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
location /api/if/svc/fio_cz/ { | ||
proxy_pass https://if-fio_cz/api/if/svc/fio_cz/; | ||
proxy_set_header Host $host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Original-URI $request_uri; | ||
proxy_ssl_protocols TLSv1.3; | ||
proxy_next_upstream error timeout http_500; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
upstream if-fio_cz { | ||
server 127.0.0.1:8017; | ||
include snippets/common/upstream.conf; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--- | ||
routes: | ||
|
||
######################################################### | ||
# IF / NODES # | ||
######################################################### | ||
|
||
be_if: | ||
service: if | ||
path: /api/if | ||
pattern: /api/if | ||
label: IF | ||
dscr: A routegroup, no methods here. | ||
|
||
|
||
######################################################### | ||
# IF SVC / fio_cz / INFO # | ||
######################################################### | ||
|
||
be_if_svc_fio_cz_v1: | ||
pattern: ${routes.be_if.path}/svc/fio_cz/v1/docs | ||
path: ${routes.be_if.path}/svc/fio_cz/v1/docs | ||
label: fio_cz | ||
dscr: Caretag SQL based integration service. | ||
service: if/fio_cz | ||
provides: docs | ||
methods: | ||
get: Glued\Controllers\IfController:docs_r1 | ||
|
||
######################################################### | ||
# IF / fio_cz / ACT # | ||
######################################################### | ||
|
||
be_if_svc_fio_cz_v1_act: | ||
pattern: ${routes.be_if.path}/svc/fio_cz/v1/act/{uuid}[/{from}] | ||
path: ${routes.be_if.path}/svc/fio_cz/v1/act | ||
label: Run action | ||
dscr: Run an action | ||
service: if/fio_cz | ||
methods: | ||
get: Glued\Controllers\IfController:act_r1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Glued\Controllers; | ||
|
||
use Psr\Container\ContainerInterface; | ||
|
||
abstract class AbstractController | ||
{ | ||
/** | ||
* @var ContainerInterface | ||
*/ | ||
protected $c; | ||
|
||
|
||
/** | ||
* AbstractController constructor. We're passing the whole container to the constructor to be | ||
* able to do stuff like $this->c->db->method(). This is considered bad pracise that makes | ||
* the whole app more memory hungry / less efficient. Dependency injection should be rewritten | ||
* to take advantage of PHP-DI's autowiring. | ||
* @param ContainerInterface $container | ||
*/ | ||
public function __construct(ContainerInterface $container) | ||
{ | ||
$this->c = $container; | ||
} | ||
|
||
|
||
/** | ||
* __get is a magic method that allows us to always get the correct property out of the | ||
* container, allowing to write $this->db->method() instead of $this->c->db->method() | ||
* @param string $property Container property | ||
*/ | ||
public function __get($property) | ||
{ | ||
if ($this->c->get($property)) { | ||
return $this->c->get($property); | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.