4- Supabase Configuration

On/Off connection:

In the update 2.5arrow-up-right this supabase option was added, and now it is optional to have database or not. To enable or disable the database or supabase connection you can go to the config.js file.

In the section of:

// Connect postgres
const postgresConnection = databaseManager.connectToPostgres(true);

// Connect storage supabase
const storageSupabase = databaseManager.connectToSupabase(true);

Here you can enable or disable the connections that by default are set to true, but... what are the 2 connections for?

// Connect postgres
const postgresConnection = databaseManager.connectToPostgres(true);

The postgresConnection is used to perform the queries with the database, as well as the creation of the tables automatically.

// Connect storage supabase
const storageSupabase = databaseManager.connectToSupabase(true);

While storageSupabase is for connecting to supabase and uploading files to the bucket as well as creating the bucket automatically.

Creating the organization

When creating the organization it is very important not to forget the key that supabase requests to create the project within the organization since later we will use it to configure the environment variables, the organization does not have any other complexity and should be created according to your parameters that suit your project.

Api Configurations

Once the supabase account is created we go to Settings > Api and there we must obtain the SUPABASE_URL and the SUPABASE_ANON_KEY.

The SUPABASE_URL is copied and uploaded as an environment variable from the terminal to fly.io:

Database Configurations

Now we will configure the environment variables for the connection with the database and for the instances to be created dynamically.

The password will be the same as the one you entered when creating the project we saw at the beginning.

Once this is done, the connection will be successful!

Finally we must configure the last environment variable in supabase which is the bucket where the files, photos, images, audios and other files will be saved when the instances are created dynamically when executing a conversation.

The name of the bucket I leave it to your choice, by default this filesFront but you can change it and place the name that you wish.

And that would be all in terms of configuration and setting environment variables.

📌 More information about supabase and its documentationarrow-up-right

Última actualización