Browse Source

fix: Support Airtable import even mapped to a different port (#2134)

* fix: set default baseurl in docker and make it configurable

re #2127

Signed-off-by: Pranav C <pranavxc@gmail.com>

* chore: update documentation

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/2165/head
Pranav C 2 years ago committed by GitHub
parent
commit
b8bdc7b712
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      packages/noco-docs/content/en/getting-started/installation.md
  2. 13
      packages/nocodb/src/lib/noco/meta/api/sync/importApis.ts

1
packages/noco-docs/content/en/getting-started/installation.md

@ -207,6 +207,7 @@ By default, SQLite is used for storing meta data. However, you can specify your
| NC_DISABLE_ERR_REPORT | No | Disable error reporting | | |
| NC_REDIS_URL | No | Custom Redis URL. Example: `redis://:authpassword@127.0.0.1:6380/4` | Meta data will be stored in memory | |
| NC_DISABLE_CACHE | No | To be used only while debugging. On setting this to `true` - meta data be fetched from db instead of redis/cache. | `false` | |
| NC_BASEURL_INTERNAL | No | Used as base url for internal(server) API calls | Default value in docker will be `http://localhost:$PORT` and in all other case it's populated from request object | |
### AWS ECS (Fargate)

13
packages/nocodb/src/lib/noco/meta/api/sync/importApis.ts

@ -67,12 +67,23 @@ export default (router: Router, clients: { [id: string]: Socket }) => {
Noco.getConfig().auth.jwt.options
);
// Treat default baseUrl as siteUrl from req object
let baseURL = (req as any).ncSiteUrl;
// if environment value avail use it
// or if it's docker construct using `PORT`
if (process.env.NC_BASEURL_INTERNAL) {
baseURL = process.env.NC_BASEURL_INTERNAL;
} else if (process.env.NC_DOCKER) {
baseURL = `http://localhost:${process.env.PORT || 8080}`;
}
NocoJobs.jobsMgr.add<AirtableSyncConfig>(AIRTABLE_IMPORT_JOB, {
id: req.query.id,
...(syncSource?.details || {}),
projectId: syncSource.project_id,
authToken: token,
baseURL: (req as any).ncSiteUrl
baseURL
});
res.json({});
})

Loading…
Cancel
Save