🔗
Demo to preview the settings
Introduction
The Bunny.net Cloud Storage plugin is a powerful tool that enables users to effortlessly connect their Bubble applications with the high-performance cloud storage solution offered by Bunny.net. With this plugin, you can easily create storage zones to store and manage files within your application.
How to setup
Place the plugin’s element “Bunny Storage” on the page and fill the field “API key” with the Bunny.net account API key .
Where to get the Access key for account - in the profile dashboard :
Where to get the Storage Zone passwords you will need for storage zone actions - from the dashboard or other API calls (”List Storage Zones” or “Get Storage Zone”).
From the dashboard:
Where to get the Storage Zone hostname - from the dashboard or other API calls (”List Storage Zones” or “Get Storage Zone”).
From the dashboard:
Plugin element: Bunny Storage
The main and only element of the plugin.
Element’s fields:
Title | Description | Type |
API key | The key of the account, taken from the dashboard of the account settings - https://dash.bunny.net/account/settings . | Text |
Plugin’s Element Exposed States
Title | Description |
Created storage ID | The id of the last created storage with "Add storage zone" action. It is a number that is returned after the storage has been created successfully. |
Error message | The message of the caught error in any of the element’s actions. |
Plugin’s Element Events
Title | Description |
File uploaded | Triggers if the response of the "Upload file" action is success, informs if the file was uploaded successfully. |
File deleted | Triggers if the response of the "Delete file" action is success, informs if the file was deleted successfully. |
Zone added | Triggers if the response of the "Add storage zone” action is success, informs if the zone was successfully added. |
Storage zone updated | Triggers if the response of the "Update storage zone” action is success, informs if the zone was successfully updated. |
Storage zone deleted | Triggers if the response of the "Delete Storage Zone” action is success, informs if the storage zone was successfully deleted. |
Password changed | Triggers if the response of the "Reset password" or "Reset read-only password" action is success, informs the user if the storage password changed. |
Returned error | Triggered when an element's action returns an error. |
Plugin’s Element Actions
Upload file
Upload a file to the user's Storage Zone mentioned.
Action fields:
Title | Description | Type |
Zone password | The password of the Storage Zone you want the file to be uploaded in.
You can find it in dashboard - “storage zone” - "FTP & API Access".
You can also get it from “Get Storage Zone” API call response. | Text |
Hostname | The endpoint of the uploaded file, please check the documentation here - "https://docs.bunny.net/reference/put_-storagezonename-path-filename".
Also it is mentioned in “storage zone” dashboard "FTP & API Access", "hostname" field.
You can also get it from “Get Storage Zone” API call response. | Text |
Storage zone name | The name of your storage zone where you are connecting to. | Text |
Path | (Optional)The path to the folder where your file will be stored. If this is the root of your storage zone, you can ignore this parameter. If you do not have a folder but want the file to be uploaded in one, just insert a path and the file will be created there.
Ex: folder/subfolder1 | Text |
File name | The name that the file will be uploaded as. Provide a valid name, with right file extension, a good practice is considered taking the file name from the “file uploader” element in Bubble when the file is loaded and using it. | Text |
File | The file that will be uploaded. It accepts the file url. Get it with Bubble “file uploader” element as it is shown in the example. | File |
Delete file
Delete an object from the storage zone. In case the object is a directory all the data in it will be recursively deleted as well.
Action fields:
Title | Description | Type |
Zone password | The password of the Storage Zone you want the file to be uploaded in.
You can find it in dashboard - “storage zone” - "FTP & API Access".
You can also get it from “Get Storage Zone” API call response. | Text |
Hostname | The endpoint of the file, please check the documentation here - "https://docs.bunny.net/reference/put_-storagezonename-path-filename".
Also it is mentioned in “storage zone” dashboard "FTP & API Access", "hostname" field.
You can also get it from “Get Storage Zone” API call response. | Text |
Storage zone name | The name of your storage zone where you are connecting to. | Text |
Path | (Optional) The path to your file folder. If this is the root of your storage zone, you can ignore this parameter.
Ex: folder/subfolder1 | Text |
File name | The name of the file that you wish to delete. | Text |
Download file
Download a file from the storage zone.
Action fields:
Title | Description | Type |
Pull zone hostname | The password of the storage zone where the folder/file is located.
You can find it in “storage zone” dashboard "FTP & API Access".
You can also get it from “Get Storage Zone” API call response. | Text |
Path | The path to your file folder. If this is the root of your storage zone, you can ignore this parameter.
Ex: folder/subfolder1 | Text |
File name | The name of the file you want to download. | Text |
Important: Downloading files requires setting up the Storage right. Please take a look at the Bunny Storage Access and Delivery Guide for more information.
Steps for the plugin’s element action “Download file” to work:
- From your account dashboard, access the Storage Zone you want to make the access to the file public and click there “+Connect Pull Zone”.
- From the opened popup, click “Add Pull Zone”.
- Give the pull zone a name and again click “Add pull zone” on the bottom.
- Save the hostname of the pull zone, as that is the one you will use for downloading files.(Keep in mind that for other actions is used storage hostname, not the pull zone one.)
- Navigate to pull zone “Edge Rules” and create one. You need that for the file to be downloaded when the action is called.
- Give it a description and from the Action dropdown, choose “Force download”.
- For condition matching add your pull zone hostname + “/*” to do the same action for all type of files and save the edge rules.
- After setting the Storage Zone right you can easily implement the plugin’s action “Download file” in your app.
Add storage zone
Add a storage zone to bunny.net cloud storage account.
Action fields:
Title | Description | Type |
Name | The name of the storage zone. Has to be a unique value(can not repeat another storage zone name), longer than 5 characters and with no space. | Text |
Region | The code of the main geographical location where the data is physically stored (Possible values: DE, NY, LA, SG) | Text |
Zone tier | Refers to different types of servers or data centers used for saving your files on the cloud (check here: https://support.bunny.net/hc/en-us/articles/360000200331-What-is-the-difference-between-Standard-and-Volume-tier-zones-) .
0 = Standard, 1 = Volume | Number |
Advanced Settings: | ||
Origin url | (Optional) Suppose you have a website hosted at www.example.com.
This is your origin URL – the primary location where your website's content is stored. | Text |
Replication regions | (Optional) The list of the geographical locations codes where your data is physically stored (Possible values: DE, NY, LA, SG) | Text |
Update storage zone
Updates the data in the storage zone with the one filled in the inputs.
Action fields:
Title | Description | Type |
Id | The ID of the storage zone that should be updated. | Text |
Advanced Settings: | ||
Replication zones | (Optional) The list of the geographical locations codes where your data is physically stored (Possible values: DE, NY, LA, SG) | Text |
Origin url | (Optional)The origin URL of the storage(Optional)The origin URL of the storage zone.
This URL represents the address of your primary server or the location where your original content is hosted.
When bunny.net receives a request for your content, it will fetch it from this URL if it's not already cached in their CDN.
Remember that the exact URL will depend on where your content is hosted. It could be a URL to a specific server (like in the example above), a cloud storage service, or another type of content repository. The key is that it must be a URL that bunny.net can access to retrieve your content. zone. | Text |
Custom 404 file path | (Optional)The path to the custom file that will be returned in a case of 404.
It's important to note that this file path is relative to the root directory of your server or hosting environment. You need to have the 404.html file (or whatever you name your custom error page) located at the specified path on your server. | Text |
Rewrite 404 to 200 | (Optional) The rewrite rule doesn't create new content; it only redirects requests for missing content to existing content (like a custom error page). Bunny.net's servers will check the rewrite rule you've set up in the Storage Dashboard. Seeing the rule, the server will fetch and serve the specified target resource. For more information check here : https://bunny.net/blog/host-your-frontend-applications-on-the-edge/ | yes/no |
Delete storage Zone
Action fields:
Title | Description | Type |
Id | The Storage Zone ID that should be deleted. | Text |
Reset password
Reset the account password. It does not return its new value.
Action fields:
Title | Description | Type |
Id | The ID of the storage zone that should have the password reset. | Text |
Reset read-only password
Reset the read-only account password. It does not return its new value.
Action fields:
Title | Description | Type |
Id | The ID of the storage zone that should have the read-only password reset. | Text |
Plugin API calls: Bunny.net Storage
List Storage Zones
Gets the profile list of storage zones with the corresponding information about them. API call used as “Data”.
API call fields:
Title | Description | Type |
Access key(header) | The key of the account, taken from the dashboard of the account settings - https://dash.bunny.net/account/settings . | Text |
Date (header) | (Optional) Insert as a dynamic value of the current time (format as Simplified extended ISO) if you need your list data to be always up to date, otherwise ignore the field. | Date |
Check the storage zone availability
Checks that storage zone is properly allocated and accessible. API call used as “Action”.
Returns in the response the “Available” filed with its values yes or no.
API call fields:
Title | Description | Type |
Access key (header) | The key of the account, taken from the dashboard of the account settings - https://dash.bunny.net/account/settings . | Text |
Name (body) | Determines the name of the zone that we are checking, it has to be a existing storage zone name. | Text |
Get Storage Zone
Gets the information about a single storage zone. API call used as “Action”.
API call fields:
Title | Description | Type |
Id (path) | The ID of the Storage Zone that should be returned | Text |
Access key | The key of the account, taken from the dashboard of the account settings - https://dash.bunny.net/account/settings . | Text |
List Files
Gets the information about all the existing files in the mentioned storage zone, on the mentioned path. API call used as “Data”.
API call fields:
Title | Description | Type |
Hostname(path) | The endpoint of the uploaded file, please check the documentation here - "https://docs.bunny.net/reference/put_-storagezonename-path-filename". Also it is mentioned in storage zone dashboard "FTP & API Access", "hostname" field. | Text |
Storage name (path) | The name of your storage zone where you are connecting to. | Text |
Path (path) | The directory path that you want to list. | Text |
AccessKey (header) | The storage zone password. | Text |
Date | (Optional) Insert as a dynamic value of the current time (format as Simplified extended ISO) if you need you list data to be always up to date, otherwise ignore the field. | Date |
Changelogs
Update: 05.06.2023 - Version: 1.7.0
- Fixed the PNG format ///empty - this is just example