(credentials: DatabaseCredentials)
| 170 | |
| 171 | // returns the "host" like localhost / 127.0.0.1 + default port |
| 172 | export function getDbLocation(credentials: DatabaseCredentials): string | undefined { |
| 173 | if (credentials.type === 'sqlite') { |
| 174 | return credentials.uri! |
| 175 | } |
| 176 | |
| 177 | const socket = getSocketFromDatabaseCredentials(credentials) |
| 178 | |
| 179 | if (socket) { |
| 180 | return `unix:${socket}` |
| 181 | } else if (credentials.host && credentials.port) { |
| 182 | return `${credentials.host}:${credentials.port}` |
| 183 | } else if (credentials.host) { |
| 184 | return `${credentials.host}` |
| 185 | } |
| 186 | |
| 187 | return undefined |
| 188 | } |
| 189 | |
| 190 | /** |
| 191 | * Return a pretty version of a "provider" (with uppercase characters) |
no test coverage detected