Skip to content

Commit 078efa1

Browse files
authored
chore: misc updates (#80)
* update sponsors * don't hardcode pg connection string * print error for proper logging
1 parent 616cf86 commit 078efa1

File tree

8 files changed

+18
-13
lines changed

8 files changed

+18
-13
lines changed

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ PG_API_DB_NAME="postgres"
1717
PG_API_DB_USER="postgres"
1818
PG_API_DB_PORT=5432
1919
PG_API_DB_PASSWORD="postgres"
20-
PG_API_DB_SSL=false
2120
```
2221

2322
Then run any of the binaries in the releases.
@@ -42,5 +41,4 @@ Apache 2.0
4241

4342
We are building the features of Firebase using enterprise-grade, open source products. We support existing communities wherever possible, and if the products don’t exist we build them and open source them ourselves. Thanks to these sponsors who are making the OSS ecosystem better for everyone.
4443

45-
[![Worklife VC](https://user-images.githubusercontent.com/10214025/90451355-34d71200-e11e-11ea-81f9-1592fd1e9146.png)](https://www.worklife.vc)
4644
[![New Sponsor](https://user-images.githubusercontent.com/10214025/90518111-e74bbb00-e198-11ea-8f88-c9e3c1aa4b5b.png)](https://github.com/sponsors/supabase)

src/api/columns.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ router.get('/', async (req, res) => {
2525
if (!include_system_schemas) payload = removeSystemSchemas(data)
2626
return res.status(200).json(payload)
2727
} catch (error) {
28-
console.log('throwing error')
28+
console.log('throwing error', error)
2929
res.status(500).json({ error: error.message })
3030
}
3131
})

src/api/config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ router.get('/', async (req, res) => {
1010
const { data } = await RunQuery(req.headers.pg, config)
1111
return res.status(200).json(data)
1212
} catch (error) {
13-
console.log('throwing error')
13+
console.log('throwing error', error)
1414
res.status(500).json({ error: error.message })
1515
}
1616
})
@@ -19,7 +19,7 @@ router.get('/version', async (req, res) => {
1919
const { data } = await RunQuery(req.headers.pg, version)
2020
return res.status(200).json(data[0]) // only one row
2121
} catch (error) {
22-
console.log('throwing error')
22+
console.log('throwing error', error)
2323
res.status(500).json({ error: error.message })
2424
}
2525
})

src/api/extensions.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ router.get('/', async (req, res) => {
1313
const { data } = await RunQuery(req.headers.pg, getExtensionsQuery)
1414
return res.status(200).json(data)
1515
} catch (error) {
16-
console.log('throwing error')
16+
console.log('throwing error', error)
1717
res.status(500).json({ error: error.message })
1818
}
1919
})
@@ -28,7 +28,7 @@ router.post('/', async (req, res) => {
2828

2929
return res.status(200).json(extension)
3030
} catch (error) {
31-
console.log('throwing error')
31+
console.log('throwing error', error)
3232
res.status(400).json({ error: error.message })
3333
}
3434
})
@@ -46,7 +46,7 @@ router.patch('/:name', async (req, res) => {
4646

4747
return res.status(200).json(updated)
4848
} catch (error) {
49-
console.log('throwing error')
49+
console.log('throwing error', error)
5050
res.status(400).json({ error: error.message })
5151
}
5252
})
@@ -64,7 +64,7 @@ router.delete('/:name', async (req, res) => {
6464

6565
return res.status(200).json(deleted)
6666
} catch (error) {
67-
console.log('throwing error')
67+
console.log('throwing error', error)
6868
res.status(400).json({ error: error.message })
6969
}
7070
})

src/api/functions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ router.get('/', async (req, res) => {
2323
if (!include_system_schemas) payload = removeSystemSchemas(data)
2424
return res.status(200).json(payload)
2525
} catch (error) {
26-
console.log('throwing error')
26+
console.log('throwing error', error)
2727
res.status(500).json({ error: error.message })
2828
}
2929
})

src/api/roles.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ router.get('/', async (req, res) => {
3232

3333
return res.status(200).json(payload)
3434
} catch (error) {
35-
console.log('throwing error')
35+
console.log('throwing error', error)
3636
res.status(500).json({ error: error.message })
3737
}
3838
})

src/api/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ router.get('/', async (req, res) => {
2424
if (!include_system_schemas) payload = removeSystemSchemas(data)
2525
return res.status(200).json(payload)
2626
} catch (error) {
27-
console.log('throwing error')
27+
console.log('throwing error', error)
2828
res.status(500).json({ error: error.message })
2929
}
3030
})

src/lib/constants.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
export const PG_API_URL = process.env.PG_API_URL || 'http://localhost'
22
export const PG_API_PORT = Number(process.env.PG_API_PORT || 1337)
33
export const CRYPTO_KEY = process.env.CRYPTO_KEY || 'SAMPLE_KEY'
4-
export const PG_CONNECTION = 'postgres://postgres:postgres@localhost:5432/postgres'
4+
5+
const PG_API_DB_HOST = process.env.PG_API_DB_HOST || 'localhost'
6+
const PG_API_DB_NAME = process.env.PG_API_DB_NAME || 'postgres'
7+
const PG_API_DB_USER = process.env.PG_API_DB_USER || 'postgres'
8+
const PG_API_DB_PORT = Number(process.env.PG_API_DB_PORT) || 5432
9+
const PG_API_DB_PASSWORD = process.env.PG_API_DB_PASSWORD || 'postgres'
10+
11+
export const PG_CONNECTION = `postgres://${PG_API_DB_USER}:${PG_API_DB_PASSWORD}@${PG_API_DB_HOST}:${PG_API_DB_PORT}/${PG_API_DB_NAME}`
512

613
export const DEFAULT_ROLES: string[] = [
714
'pg_read_all_settings',

0 commit comments

Comments
 (0)