mirror of
https://github.com/feeddeck/feeddeck.git
synced 2026-05-29 06:46:07 -05:00
We have to add in-app purchases for the iOS, macOS and Android store, so that users can also get the premium features of the app without using Stripe for payments. The in-app purchases are only enabled when a user uses the app with the default Supabase environment or with the Supabase environment provided during build time. If a user uses his own Supabase instance, he will not be able to upgrade to the premium tier via in-app purchases. We are using RevenueCat for in-app purchases, which automatically sends all the events for a user to the "revenuecat-webhooks-v1" edge function. Depending on the received event we can then upgrade / downgrade the users profile. To be able to use RevenueCat as an additional provider to Stripe we also had to add a new "subscriptionProvider" provider column to the "profiles" table, which stores the information via which provider a user upgraded his account.
80 lines
4.2 KiB
TypeScript
80 lines
4.2 KiB
TypeScript
/**
|
|
* Supabase Configuration
|
|
* - FEEDDECK_SUPABASE_SITE_URL is the site url of the Supabase project as it must be provided in the Authentication ->
|
|
* URL Configuration -> Site URL section in the Supabase Studio.
|
|
* - FEEDDECK_SUPABASE_URL is the url of the Supabase project as it is shown in the Project Settings -> API section in
|
|
* the Supabase Studio.
|
|
* - FEEDDECK_SUPABASE_ANON_KEY is the anon key of the Supabase project as it is shown in the Project Settings -> API
|
|
* section in the Supabase Studio.
|
|
* - FEEDDECK_SUPABASE_SERVICE_ROLE_KEY is the service role key of the Supabase project as it is shown in the Project
|
|
* Settings -> API section in the Supabase Studio.
|
|
*/
|
|
export const FEEDDECK_SUPABASE_SITE_URL = Deno.env.get("SUPABASE_SITE_URL") ??
|
|
Deno.env.get("FEEDDECK_SUPABASE_SITE_URL") ?? "";
|
|
export const FEEDDECK_SUPABASE_URL = Deno.env.get("SUPABASE_URL") ??
|
|
Deno.env.get("FEEDDECK_SUPABASE_URL") ?? "";
|
|
export const FEEDDECK_SUPABASE_ANON_KEY = Deno.env.get("SUPABASE_ANON_KEY") ??
|
|
Deno.env.get("FEEDDECK_SUPABASE_ANON_KEY") ?? "";
|
|
export const FEEDDECK_SUPABASE_SERVICE_ROLE_KEY =
|
|
Deno.env.get("SUPABASE_SERVICE_ROLE_KEY") ??
|
|
Deno.env.get("FEEDDECK_SUPABASE_SERVICE_ROLE_KEY") ?? "";
|
|
|
|
/**
|
|
* Encryption Configuration for Accounts
|
|
* - FEEDDECK_ENCRYPTION_KEY is the encryption key used to encrypt the accounts of an user like the personal access
|
|
* token for the GitHub account of the user.
|
|
* - FEEDDECK_ENCRYPTION_IV is the initialization vector used to encrypt the accounts of an user.
|
|
*
|
|
* Note: The FEEDDECK_ENCRYPTION_KEY and FEEDDECK_ENCRYPTION_IV can be generated using the following command:
|
|
* deno run --allow-net --allow-env --import-map=./supabase/functions/import_map.json ./supabase/functions/_cmd/cmd.ts tools generate-key
|
|
*/
|
|
export const FEEDDECK_ENCRYPTION_KEY =
|
|
Deno.env.get("FEEDDECK_ENCRYPTION_KEY") ?? "";
|
|
export const FEEDDECK_ENCRYPTION_IV = Deno.env.get("FEEDDECK_ENCRYPTION_IV") ??
|
|
"";
|
|
|
|
/**
|
|
* Redis Configuration
|
|
* - FEEDDECK_REDIS_HOSTNAME is the hostname of the Redis instance, used for the scheduler and worker.
|
|
* - FEEDDECK_REDIS_PORT is the port of the Redis instance, used for the scheduler and worker.
|
|
* - FEEDDECK_REDIS_USERNAME is the username which is used for the Redis connection.
|
|
* - FEEDDECK_REDIS_PASSWORD is the password which is used for the Redis connection.
|
|
*/
|
|
export const FEEDDECK_REDIS_HOSTNAME =
|
|
Deno.env.get("FEEDDECK_REDIS_HOSTNAME") ?? "127.0.0.1";
|
|
export const FEEDDECK_REDIS_PORT = Deno.env.get("FEEDDECK_REDIS_PORT") ?? 6379;
|
|
export const FEEDDECK_REDIS_USERNAME =
|
|
Deno.env.get("FEEDDECK_REDIS_USERNAME") ?? undefined;
|
|
export const FEEDDECK_REDIS_PASSWORD =
|
|
Deno.env.get("FEEDDECK_REDIS_PASSWORD") ?? undefined;
|
|
|
|
/**
|
|
* Stripe Configuration
|
|
* - FEEDDECK_STRIPE_API_KEY is the API key to access the Stripe API.
|
|
* - FEEDDECK_STRIPE_PRICE_ID is the id of the price used for the subscription.
|
|
* - FEEDDECK_STRIPE_WEBHOOK_SIGNING_SECRET is the signing secret used to verify the Stripe webhook calls.
|
|
* - FEEDDECK_REVENUECAT_ENVIRONMENT is the Store environment, this could be "SANDBOX" or "PRODUCTION".
|
|
* - FEEDDECK_REVENUECAT_WEBHOOK_HEADER is the value of the authorization header send by RevenueCat.
|
|
*/
|
|
export const FEEDDECK_STRIPE_API_KEY =
|
|
Deno.env.get("FEEDDECK_STRIPE_API_KEY") ?? "";
|
|
export const FEEDDECK_STRIPE_PRICE_ID =
|
|
Deno.env.get("FEEDDECK_STRIPE_PRICE_ID") ?? "";
|
|
export const FEEDDECK_STRIPE_WEBHOOK_SIGNING_SECRET =
|
|
Deno.env.get("FEEDDECK_STRIPE_WEBHOOK_SIGNING_SECRET") ?? "";
|
|
export const FEEDDECK_REVENUECAT_WEBHOOK_HEADER =
|
|
Deno.env.get("FEEDDECK_REVENUECAT_WEBHOOK_HEADER") ?? "";
|
|
|
|
/**
|
|
* Source Configuration
|
|
* - FEEDDECK_SOURCE_NITTER_INSTANCE is the url of the Nitter instance used by FeedDeck.
|
|
* - FEEDDECK_SOURCE_NITTER_BASIC_AUTH is the basic auth header used to scrape the Nitter instance.
|
|
* - FEEDDECK_SOURCE_YOUTUBE_API_KEY is the API key used to access the YouTube API.
|
|
*/
|
|
export const FEEDDECK_SOURCE_NITTER_INSTANCE =
|
|
Deno.env.get("FEEDDECK_SOURCE_NITTER_INSTANCE") ?? "";
|
|
export const FEEDDECK_SOURCE_NITTER_BASIC_AUTH =
|
|
Deno.env.get("FEEDDECK_SOURCE_NITTER_BASIC_AUTH") ?? "";
|
|
export const FEEDDECK_SOURCE_YOUTUBE_API_KEY =
|
|
Deno.env.get("FEEDDECK_SOURCE_YOUTUBE_API_KEY") ?? "";
|