@@ -22,12 +22,13 @@ import {
2222 getRenderProgress ,
2323 type AwsRegion ,
2424} from "@remotion/lambda/client" ;
25+ import { getConfigValue } from "@/lib/config" ;
2526
2627// ---------------------------------------------------------------------------
2728// Types
2829// ---------------------------------------------------------------------------
2930
30- export interface RemotionConfig {
31+ export interface RemotionLambdaConfig {
3132 awsAccessKeyId : string ;
3233 awsSecretAccessKey : string ;
3334 region : string ;
@@ -130,11 +131,11 @@ function mapInputProps(input: RenderInput): Record<string, unknown> {
130131 * Get Remotion Lambda configuration from environment variables.
131132 * Throws if any required env var is missing.
132133 */
133- export function getRemotionConfig ( ) : RemotionConfig {
134+ export async function getRemotionConfig ( ) : Promise < RemotionLambdaConfig > {
134135 const awsAccessKeyId = process . env . AWS_ACCESS_KEY_ID ;
135136 const awsSecretAccessKey = process . env . AWS_SECRET_ACCESS_KEY ;
136- const region = process . env . REMOTION_AWS_REGION ;
137- const serveUrl = process . env . REMOTION_SERVE_URL ;
137+ const region = await getConfigValue ( "remotion_config" , "awsRegion" , process . env . REMOTION_AWS_REGION ) ;
138+ const serveUrl = await getConfigValue ( "remotion_config" , "serveUrl" , process . env . REMOTION_SERVE_URL ) ;
138139
139140 const missing : string [ ] = [ ] ;
140141 if ( ! awsAccessKeyId ) missing . push ( "AWS_ACCESS_KEY_ID" ) ;
@@ -161,8 +162,8 @@ export function getRemotionConfig(): RemotionConfig {
161162/**
162163 * Get the Lambda function name from env or use the default.
163164 */
164- function getFunctionName ( ) : string {
165- return process . env . REMOTION_FUNCTION_NAME || DEFAULT_FUNCTION_NAME ;
165+ async function getFunctionName ( ) : Promise < string > {
166+ return getConfigValue ( "remotion_config" , "functionName" , process . env . REMOTION_FUNCTION_NAME || DEFAULT_FUNCTION_NAME ) ;
166167}
167168
168169// ---------------------------------------------------------------------------
@@ -202,8 +203,8 @@ async function startRender(
202203 composition : string ,
203204 input : RenderInput
204205) : Promise < { renderId : string ; bucketName : string } > {
205- const config = getRemotionConfig ( ) ;
206- const functionName = getFunctionName ( ) ;
206+ const config = await getRemotionConfig ( ) ;
207+ const functionName = await getFunctionName ( ) ;
207208 const region = config . region as AwsRegion ;
208209
209210 log ( `Starting render for composition "${ composition } "` , {
@@ -291,8 +292,8 @@ export async function checkRenderProgress(
291292 renderId : string ,
292293 bucketName : string
293294) : Promise < RenderProgressResult > {
294- const config = getRemotionConfig ( ) ;
295- const functionName = getFunctionName ( ) ;
295+ const config = await getRemotionConfig ( ) ;
296+ const functionName = await getFunctionName ( ) ;
296297 const region = config . region as AwsRegion ;
297298
298299 const progress = await getRenderProgress ( {
0 commit comments