lowdefy/packages/docs/connections/MSSQL.yaml

91 lines
3.0 KiB
YAML

# Copyright 2020-2021 Lowdefy, Inc
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
_ref:
path: templates/general.yaml.njk
vars:
pageId: MSSQL
pageTitle: Microsoft SQL Server
section: Connections
filePath: connections/MSSQL.yaml
content:
- id: markdown_intro
type: Markdown
properties:
content: |
The [Knex](/Knex) connection can be used to connect to [Microsoft SQL Server](https://www.microsoft.com/en-us/sql-server/sql-server-2019).
- id: markdown_connection
type: MarkdownWithCode
properties:
content: |
## Connections
Connection types:
- Knex
### Knex
#### Properties
- `client: enum`: __Required__ - Should be `mssql` to connect to Microsoft SQL Server.
- `connection: object | string `: __Required__ - Connection object or string to pass to the [`mssql`](https://www.npmjs.com/package/mssql) database client.
- `useNullAsDefault: boolean`: If true, undefined keys are replaced with NULL instead of DEFAULT.
#### Examples
###### Connection object:
```yaml
connections:
- id: mssql
type: Knex
properties:
client: mssql
connection:
host:
_secret: MSSQL_HOST
database:
_secret: MSSQL_DB
user:
_secret: MSSQL_USER
password:
_secret: MSSQL_PASSWORD
```
Environment variables:
```
LOWDEFY_SECRET_MSSQL_HOST = database.server.com
LOWDEFY_SECRET_MSSQL_DB = db
LOWDEFY_SECRET_MSSQL_USER = user
LOWDEFY_SECRET_MSSQL_PASSWORD = password
```
###### Secret connection string:
```yaml
connections:
- id: mssql
type: Knex
properties:
client: mssql
connection:
_secret: MSSQL_CONNECTION_STRING
```
Environment variables:
```
LOWDEFY_SECRET_MSSQL_CONNECTION_STRING = mssql://user:password@database.server.com:1433/db
```
- id: markdown_requests
type: MarkdownWithCode
properties:
content:
_ref: connections/KnexRequests.md