Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Postgres port / add document for CockroachDB #1113

Closed
wants to merge 11 commits into from
7 changes: 5 additions & 2 deletions .github/ISSUE_TEMPLATE/question.md
Expand Up @@ -6,10 +6,13 @@ assignees: ''
---

**Your question**
A clear and concise question.
<!-- A clear and concise question. -->

**What are you trying to do**
A description of what you are trying to do, for context.
<!-- A description of what you are trying to do, for context. -->

**Reproduction**
<!-- If your question is code related, adding a reproduction to your use case can greatly reduce the time it takes us to figure out how to better help you. -->

**Feedback**
*Documentation refers to searching through [online documentation](https://next-auth.js.org), code comments and issue history. The example project refers to [next-auth-example](https://github.com/iaincollins/next-auth-example).*
Expand Down
8 changes: 5 additions & 3 deletions .github/stale.yml
Expand Up @@ -8,15 +8,17 @@ exemptLabels:
- security
- priority
# Label to use when marking an issue as stale
staleLabel: wontfix
staleLabel: stale
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
Hi there! It looks like this issue hasn't had any activity for a while.
It will be closed if no further activity occurs. If you think your issue
is still relevant, feel free to comment on it to keep ot open. Thanks!
is still relevant, feel free to comment on it to keep it open. (Read more at #912)
Thanks!
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: >
Hi there! It looks like this issue hasn't had any activity for a while.
To keep things tidy, I am going to close this issue for now.
If you think your issue is still relevant, just leave a comment
and I will reopen it. Thanks!
and I will reopen it. (Read more at #912)
Thanks!
8 changes: 6 additions & 2 deletions .github/workflows/build.yml
Expand Up @@ -4,9 +4,13 @@ name: Build Test

on:
push:
branches: [ main ]
branches:
- main
- canary
pull_request:
branches: [ main ]
branches:
- main
- canary

jobs:
build:
Expand Down
36 changes: 30 additions & 6 deletions www/docs/configuration/databases.md
Expand Up @@ -96,7 +96,7 @@ database: {
}
```

:::warning
:::warning
**The `synchronize` option should not be used against production databases.**

It is useful to create the tables you need when setting up a database for the first time, but it should not be enabled against production databases as it may result in data loss if there is a difference between the schema that found in the database and the schema that the version of NextAuth.js being used is expecting.
Expand Down Expand Up @@ -136,17 +136,44 @@ Install module:
database: 'mariadb://username:password@127.0.0.1:3306/database_name'
```

### Postgres
### Postgres / CockroachDB

Install module:
`npm i pg`

#### Example

PostgresDB
```js
database: 'postgres://username:password@127.0.0.1:3306/database_name'
database: 'postgres://username:password@127.0.0.1:5432/database_name'
```

CockroachDB
```js
database: 'postgres://username:password@127.0.0.1:26257/database_name'
```

If the node is using Self-signed cert

```js
database: {
type: "cockroachdb",
host: process.env.DATABASE_HOST,
port: 26257,
username: process.env.DATABASE_USER,
password: process.env.DATABASE_PASSWORD,
database: process.env.DATABASE_NAME,
ssl: {
rejectUnauthorized: false,
ca: fs.readFileSync('/path/to/server-certificates/root.crt').toString()
},
},
```

Read more: [https://node-postgres.com/features/ssl](https://node-postgres.com/features/ssl)

---

### Microsoft SQL Server

Install module:
Expand Down Expand Up @@ -182,9 +209,6 @@ Install module:
database: 'sqlite://localhost/:memory:'
```


---

## Other databases

See the [documentation for adapters](/schemas/adapters) for more information on advanced configuration, including how to use NextAuth.js with other databases using a [custom adapter](/tutorials/creating-a-database-adapter).
1 change: 1 addition & 0 deletions www/docs/contributors.md
Expand Up @@ -12,6 +12,7 @@ title: Contributors
* <a href="https://github.com/geraldnolan">Gerald Nolan</a>
* <a href="https://github.com/lluia">Lluis Agusti</a>
* <a href="https://github.com/JeffersonBledsoe">Jefferson Bledsoe</a>
* <a href="https://github.com/balazsorban44">Balázs Orbán</a>

_Special thanks to Lori Karikari for creating most of the providers, to Nico Domino for creating this site, to Fredrik Pettersen for creating the Prisma adapter, to Gerald Nolan for adding support for Sign in with Apple, to Lluis Agusti for work to add TypeScript definitions and to Jefferson Bledsoe for working on automating testing._

Expand Down
8 changes: 5 additions & 3 deletions www/docusaurus.config.js
Expand Up @@ -48,14 +48,12 @@ module.exports = {
}
]
},
/*
announcementBar: {
id: 'release-candiate-announcement',
content: 'NextAuth.js v2.0 has been released <a target="_blank" rel="noopener noreferrer" href="https://www.npmjs.com/package/next-auth">npm i next-auth</a>',
content: 'NextAuth.js now has automatic 🤖 releases 🎉! Check out the <a href="https://next-auth-git-canary.nextauthjs.vercel.app">Canary documentation 📚</a>',
backgroundColor: '#2DB2F9',
textColor: '#fff'
},
*/
footer: {
links: [
{
Expand All @@ -68,6 +66,10 @@ module.exports = {
{
label: 'Contributors',
to: '/contributors'
},
{
label: 'Canary docs',
to: 'https://next-auth-git-canary.nextauthjs.vercel.app/'
}
]
},
Expand Down