Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
killua-eu committed Feb 20, 2024
1 parent aaf4034 commit 4f884df
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,16 @@ TODO: token
## Using from the command line

```bash
#new
curl -k -X POST https://glued/api/stor/v1/buckets/1fcb4d5c-5364-4cf3-b24e-070c4c71f8d2/objects -H 'Authorization: Bearer gtk_35MCHFgkNh1PymQEOLStzMtESdo4DZXykoYWvjX9QcQ=' -H 'Content-Type: multipart/form-data' -F 'refs={"Ryanair.pdf":{"predecessor":"77384ad2-80a4-11ee-9edc-9747c96a1231","sekatko:vpd":["77384ad2-80a4-11ee-9edc-9747c96a1231", "bd4a3c4a-80a6-11ee-8e34-67217a8a9f66"]}};type=application/json' -F 'meta={"Ryanair.pdf":{"sekatko":{"ocr":"sometext"},"otherapp":{"whatever":"https://glued.example.com"}}};type=application/json' -F 'file[]=@/home/killua/Ryanair.pdf' -F 'file[]=@/home/killua/eastern loves_INDUSTRA.png' -F 'file[]=@/home/killua/todo-petru' -F 'field1=fiels2' | jq .
#create a new file
#curl -k -X POST https://glued/api/stor/v1/buckets/1fcb4d5c-5364-4cf3-b24e-070c4c71f8d2/objects
curl -k -X POST https://gdev.industra.space/api/stor/v1/buckets/30ef1e33-da44-4503-85b0-a2ba41e2d82e/objects \
-H 'Authorization: Bearer gtk_35MCHFgkNh1PymQEOLStzMtESdo4DZXykoYWvjX9QcQ=' \
-H 'Content-Type: multipart/form-data' \
-F 'refs={"Ryanair.pdf":{"predecessor":"77384ad2-80a4-11ee-9edc-9747c96a1231","sekatko:vpd":["77384ad2-80a4-11ee-9edc-9747c96a1231", "bd4a3c4a-80a6-11ee-8e34-67217a8a9f66"]}};type=application/json' \
-F 'meta={"Ryanair.pdf":{"sekatko":{"ocr":"sometext"},"otherapp":{"whatever":"https://glued.example.com"}}};type=application/json' \
-F 'file[]=@/home/killua/Ryanair.pdf' \
-F 'file[]=@/home/killua/eastern loves_INDUSTRA.png' \
-F 'field1=fiels2' | jq .
```


Expand Down
2 changes: 1 addition & 1 deletion glued/Config/Nginx/snippets/location/glued-stor.conf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ location /api/stor/ {
proxy_read_timeout 1800s;
proxy_send_timeout 1800s;

#
#
location /api/stor/v1/links/ {
add_header Content-Security-Policy "upgrade-insecure-requests" always;
proxy_pass https://stor/api/stor/v1/links/;
Expand Down
2 changes: 1 addition & 1 deletion glued/Controllers/ServiceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ private function object_refs($objUUID, $objRefs, $action = null): void {
private function write_object($file, $bucket, $meta = null, $refs = null): array {

// Filter writable devices (for now, only filesystem devices are allowed)
foreach ($bucket['devices'] as &$dev) { $dev['path'] = $this->devices($dev['uuid'])['path']; }
foreach ($bucket['devices'] as &$dev) { $dev['path'] = $this->devices($dev['uuid'])['path'] ?? null; }
$localDevices = array_filter($bucket['devices'], function ($device) {
return isset($device["path"]) && is_string($device["path"]) &&
$device["health"] == "online" && $device["role"] == "storage" && $device["adapter"] == "filesystem";
Expand Down
5 changes: 3 additions & 2 deletions glued/container.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,10 @@

// Load and parse the yaml configs. Replace yaml references with $_ENV and $seed ($_ENV has precedence)
// TODO replicate foreach below to other microservices.
// TODO document in readme that no recursive array_merge is done and that you intentionally have to repeat defaults or alternatively use extensions such as 'overwrite' and 'append' to differentate and merge arrays recursively (or not) accordingly
// TODO document in readme that no recursive array_merge is done and that you intentionally have to repeat defaults
// or alternatively use extensions such as 'overwrite' and 'append' to differentate and merge arrays recursively (or not) accordingly
$files[] = __ROOT__ . '/vendor/vaizard/glued-lib/src/defaults.yaml';
$files = array_merge($files, glob($refs['env']['DATAPATH'] . '/glued-stor/config/*.yaml'));
$files = array_merge($files, glob($refs['env']['DATAPATH'] . '/glued-stor/config/*.y*ml'));
foreach ($files as $file) {
$yaml = file_get_contents($file);
$array = $class_sy->parse($yaml, $class_sy::PARSE_CONSTANT);
Expand Down

0 comments on commit 4f884df

Please sign in to comment.