chore: simplify proxy config

This commit is contained in:
Daniel Rochetti 2024-01-28 10:09:40 -08:00
parent 12887d4b87
commit 129ad9ed10
No known key found for this signature in database
GPG Key ID: 791E89AB68BDD5DB
5 changed files with 7 additions and 17 deletions

View File

@ -63,9 +63,7 @@ For example, if you are using Next.js, you can:
```ts
import * as fal from '@fal-ai/serverless-client';
fal.config({
requestMiddleware: fal.withProxy({
targetUrl: '/api/fal/proxy',
}),
proxyUrl: '/api/fal/proxy',
});
```
4. Make sure your server has `FAL_KEY` as environment variable with a valid API Key. That's it! Now your client calls will route through your server proxy, so your credentials are protected.

View File

@ -6,10 +6,8 @@ import { useMemo, useState } from 'react';
// @snippet:start(client.config)
fal.config({
// credentials: 'FAL_KEY_ID:FAL_KEY_SECRET',
requestMiddleware: fal.withProxy({
targetUrl: '/api/fal/proxy', // the built-int nextjs proxy
// targetUrl: 'http://localhost:3333/api/fal/proxy', // or your own external proxy
}),
proxyUrl: '/api/fal/proxy', // the built-int nextjs proxy
// proxyUrl: 'http://localhost:3333/api/fal/proxy', // or your own external proxy
});
// @snippet:end

View File

@ -5,9 +5,7 @@ import { useCallback, useMemo, useState } from 'react';
fal.config({
// credentials: 'FAL_KEY_ID:FAL_KEY_SECRET',
requestMiddleware: fal.withProxy({
targetUrl: '/api/fal/proxy',
}),
proxyUrl: '/api/fal/proxy',
});
type ErrorProps = {

View File

@ -3,10 +3,8 @@ import { useMemo, useState } from 'react';
// @snippet:start(client.config)
fal.config({
requestMiddleware: fal.withProxy({
targetUrl: '/api/fal/proxy', // the built-int nextjs proxy
// targetUrl: 'http://localhost:3333/api/fal/proxy', // or your own external proxy
}),
proxyUrl: '/api/fal/proxy', // the built-int nextjs proxy
// proxyUrl: 'http://localhost:3333/api/fal/proxy', // or your own external proxy
});
// @snippet:end

View File

@ -68,9 +68,7 @@ Once you've set up the proxy, you can configure the client to use it:
import * as fal from '@fal-ai/serverless-client';
fal.config({
requestMiddleware: fal.withProxy({
targetUrl: '/api/fal/proxy', // or https://my.app.com/api/fal/proxy
}),
proxyUrl: '/api/fal/proxy', // or https://my.app.com/api/fal/proxy
});
```