-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement UpdatableAdapter on adapter
This updates the adapter so that we can use `updatePolicy` from the enforcer.
- Loading branch information
Showing
5 changed files
with
5,888 additions
and
4,925 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,28 @@ | ||
import { DataSourceOptions } from 'typeorm'; | ||
|
||
export const connectionConfig: DataSourceOptions = { | ||
type: 'mysql', | ||
host: 'localhost', | ||
port: parseInt(process.env.MYSQL_PORT || '', 10) || 3306, | ||
username: process.env.MYSQL_USER || 'root', | ||
password: | ||
process.env.MYSQL_PASSWORD !== undefined | ||
? process.env.MYSQL_PASSWORD === '' | ||
? undefined | ||
: process.env.MYSQL_PASSWORD | ||
: 'password', | ||
database: process.env.MYSQL_DB || 'casbin', | ||
dropSchema: true, | ||
}; | ||
const SHOULD_USE_MYSQL = | ||
process.env.MYSQL_USER != null || | ||
process.env.MYSQL_PORT != null || | ||
process.env.MYSQL_PASSWORD != null || | ||
process.env.MYSQL_DB != null; | ||
|
||
export const connectionConfig: DataSourceOptions = SHOULD_USE_MYSQL | ||
? { | ||
type: 'mysql', | ||
host: 'localhost', | ||
port: parseInt(process.env.MYSQL_PORT || '', 10) || 3306, | ||
username: process.env.MYSQL_USER || 'root', | ||
password: | ||
process.env.MYSQL_PASSWORD !== undefined | ||
? process.env.MYSQL_PASSWORD === '' | ||
? undefined | ||
: process.env.MYSQL_PASSWORD | ||
: 'password', | ||
database: process.env.MYSQL_DB || 'casbin', | ||
dropSchema: true, | ||
} | ||
: { | ||
type: 'sqlite', | ||
database: ':memory:', | ||
dropSchema: true, | ||
}; |
Oops, something went wrong.