From c1f567a9ef00f704210082eb908642a8c040234b Mon Sep 17 00:00:00 2001 From: Tushar Dahiya Date: Fri, 7 Oct 2022 09:42:45 +0530 Subject: [PATCH 1/4] Update add-storage-adapter.md --- docs/tutorials/add-storage-adapter.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/tutorials/add-storage-adapter.md b/docs/tutorials/add-storage-adapter.md index 26a7167ddd..f3d516d83b 100644 --- a/docs/tutorials/add-storage-adapter.md +++ b/docs/tutorials/add-storage-adapter.md @@ -8,20 +8,20 @@ This document is part of the Appwrite contributors' guide. Before you continue r Storage providers help us use various storage services to store our Appwrite data. As of the writing of these lines we already support Local storage, [AWS S3](https://aws.amazon.com/s3/) storage and [Digitalocean Spaces](https://www.digitalocean.com/products/spaces/) storage. -As the storage library is separated into [utopia-php/storage](https://github.com/utopia-php/storage), adding new storage adapter will consist of two phases. First adding and implementing the new adapter in the [utopia-php/storage](https://github.com/utopia-php/storage) and then adding support to the new storage adapter in Appwrite. +As the storage library is separated into [utopia-php/storage](https://github.com/utopia-php/storage), adding a new storage adapter will consist of two phases. First adding and implementing the new adapter in the [utopia-php/storage](https://github.com/utopia-php/storage) and then adding support to the new storage adapter in Appwrite. ### Phase 1 In phase 1, we will introduce and implement the new device adapter in [utopia-php/storage](https://github.com/utopia-php/storage) library. ### Add new adapter -Add a new storage adapter inside `src/Storage/Device/` folder. Use one of the existing ones as a reference. The new adapter class should extend `Device` class and implement all the required methods. +Add a new storage adapter inside the `src/Storage/Device/` folder. Use one of the existing ones as a reference. The new adapter class should extend `Device` class and implement all the required methods. Note that the class name should start with a capital letter as PHP FIG standards suggest. Always use properly named environment variables if any credentials are required. ### Introduce new device constant -Introduce newly added device constant in `src/Storage/Storage.php` alongside existing device constants. The device constant should start with `const DEVICE_` as the existing ones. +Introduce newly added device constants in `src/Storage/Storage.php` alongside existing device constants. The device constant should start with `const DEVICE_` as the existing ones. ### Introduce new device tests Add tests for the newly added device adapter inside `tests/Storage/Device`. Use the existing adapter tests as a reference. The test file and class should be properly named `Test.php` and class should be `Test` @@ -34,18 +34,18 @@ If everything goes well, create a new pull request in [utopia-php/storage](https ### Phase 2 In this phase we will add support to the new storage adapter in Appwrite. -* Note for this to happen, your PR in the first phase should have been merged and new version of [utopia-php/storage](https://github.com/utopia-php/storage) library released. +* Note for this to happen, your PR in the first phase should have been merged and a new version of [utopia-php/storage](https://github.com/utopia-php/storage) library released. ### Upgrade the utopia-php/storage dependency Upgrade the utopia-php/storage dependency in `composer.json` file. ### Introduce new environment variables -If required for the new adapter, may be for credentials, introduce new environment variables. The storage environment variables are prefixed as `_APP_STORAGE_DEVICE`. Please read [Adding Environment Variables]() guidelines in order to properly introduce new environment variables. +If required for the new adapter, maybe for credentials, introduce new environment variables. The storage environment variables are prefixed as `_APP_STORAGE_DEVICE`. Please read [Adding Environment Variables]() guidelines in order to properly introduce new environment variables. ### Implement the device case -In `app/controllers/shared/api.php` inside init function, there is a `switch/case` statements for each supported storage device. Implement the instantiation of your device type for your device case. The device cases are the devices constants listed in the `uptopa-php/storage/Storage` class. +In `app/controllers/shared/api.php` inside init function, there are `switch/case` statements for each supported storage device. Implement the instantiation of your device type for your device case. The device cases are the device constants listed in the `uptopa-php/storage/Storage` class. ### Test and verify everything works -To test you can switch to your newly added device using `_APP_STORAGE_DEVICE` environment variable. Then run `docker compose build && docker compose up -d` in order to build the containers with updated changes. Once the containers are running, login to Appwrite console and create a project. Then in storage section, try to upload, preview, delete files. +To test you can switch to your newly added device using `_APP_STORAGE_DEVICE` environment variable. Then run `docker compose build && docker compose up -d` in order to build the containers with updated changes. Once the containers are running, login to Appwrite console and create a project. Then in the storage section, try to upload, preview, delete files. If everything goes well, initiate a pull request to appwrite repository. From 7982a493323059f8c07e42690fd34f0d93bc962e Mon Sep 17 00:00:00 2001 From: Tushar Dahiya Date: Sun, 9 Oct 2022 16:50:11 +0530 Subject: [PATCH 2/4] Update add-storage-adapter.md --- docs/tutorials/add-storage-adapter.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorials/add-storage-adapter.md b/docs/tutorials/add-storage-adapter.md index f3d516d83b..71820b2ccf 100644 --- a/docs/tutorials/add-storage-adapter.md +++ b/docs/tutorials/add-storage-adapter.md @@ -21,7 +21,7 @@ Note that the class name should start with a capital letter as PHP FIG standards Always use properly named environment variables if any credentials are required. ### Introduce new device constant -Introduce newly added device constants in `src/Storage/Storage.php` alongside existing device constants. The device constant should start with `const DEVICE_` as the existing ones. +Introduce newly added device constant in `src/Storage/Storage.php` alongside existing device constants. The device constant should start with `const DEVICE_` as the existing ones. ### Introduce new device tests Add tests for the newly added device adapter inside `tests/Storage/Device`. Use the existing adapter tests as a reference. The test file and class should be properly named `Test.php` and class should be `Test` From 25f46908b6a7b58555c09eb19d71cc1000780bfd Mon Sep 17 00:00:00 2001 From: Tushar Dahiya Date: Sun, 9 Oct 2022 16:59:48 +0530 Subject: [PATCH 3/4] Update add-storage-adapter.md --- docs/tutorials/add-storage-adapter.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorials/add-storage-adapter.md b/docs/tutorials/add-storage-adapter.md index 71820b2ccf..a24902465a 100644 --- a/docs/tutorials/add-storage-adapter.md +++ b/docs/tutorials/add-storage-adapter.md @@ -40,7 +40,7 @@ In this phase we will add support to the new storage adapter in Appwrite. Upgrade the utopia-php/storage dependency in `composer.json` file. ### Introduce new environment variables -If required for the new adapter, maybe for credentials, introduce new environment variables. The storage environment variables are prefixed as `_APP_STORAGE_DEVICE`. Please read [Adding Environment Variables]() guidelines in order to properly introduce new environment variables. +Introduce new environment variables if the adaptor requires new configuration information or to pass in credentials. The storage environment variables are prefixed as `_APP_STORAGE_DEVICE`. Please read [Adding Environment Variables]() guidelines in order to properly introduce new environment variables. ### Implement the device case In `app/controllers/shared/api.php` inside init function, there are `switch/case` statements for each supported storage device. Implement the instantiation of your device type for your device case. The device cases are the device constants listed in the `uptopa-php/storage/Storage` class. From 35ba33cb49f6a2d43a73b3e141167f5611dd0034 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Fri, 27 Jan 2023 13:02:17 +0000 Subject: [PATCH 4/4] chore: review comments --- docs/tutorials/add-storage-adapter.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorials/add-storage-adapter.md b/docs/tutorials/add-storage-adapter.md index 786c4a9ba6..b48005ad1f 100644 --- a/docs/tutorials/add-storage-adapter.md +++ b/docs/tutorials/add-storage-adapter.md @@ -46,7 +46,7 @@ In this phase we will add support to the new storage adapter in Appwrite. Upgrade the utopia-php/storage dependency in `composer.json` file. ### Introduce new environment variables -Introduce new environment variables if the adaptor requires new configuration information or to pass in credentials. The storage environment variables are prefixed as `_APP_STORAGE_DEVICE`. Please read [Adding Environment Variables]() guidelines in order to properly introduce new environment variables. +Introduce new environment variables if the adapter requires new configuration information or to pass in credentials. The storage environment variables are prefixed as `_APP_STORAGE_DEVICE`. Please read [Adding Environment Variables](https://github.com/appwrite/appwrite/blob/master/docs/tutorials/add-environment-variable.md) guidelines in order to properly introduce new environment variables. ### Implement the device case In `app/controllers/shared/api.php` inside init function, there are `switch/case` statements for each supported storage device. Implement the instantiation of your device type for your device case. The device cases are the device constants listed in the `uptopa-php/storage/Storage` class.