Skip to content

Commit

Permalink
Merge pull request #547 from FlowiseAI/feature/Credential
Browse files Browse the repository at this point in the history
Feature/Credential
  • Loading branch information
HenryHengZJ authored Jul 28, 2023
2 parents dd0f316 + 05dd23b commit a817ab6
Show file tree
Hide file tree
Showing 224 changed files with 11,522 additions and 6,015 deletions.
42 changes: 22 additions & 20 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,26 +118,28 @@ Flowise has 3 different modules in a single mono repository.

Flowise support different environment variables to configure your instance. You can specify the following variables in the `.env` file inside `packages/server` folder. Read [more](https://docs.flowiseai.com/environment-variables)

| Variable | Description | Type | Default |
| -------------------------- | ---------------------------------------------------------------- | ------------------------------------------------ | ----------------------------------- |
| PORT | The HTTP port Flowise runs on | Number | 3000 |
| FLOWISE_USERNAME | Username to login | String | |
| FLOWISE_PASSWORD | Password to login | String | |
| DEBUG | Print logs from components | Boolean | |
| LOG_PATH | Location where log files are stored | String | `your-path/Flowise/logs` |
| LOG_LEVEL | Different levels of logs | Enum String: `error`, `info`, `verbose`, `debug` | `info` |
| APIKEY_PATH | Location where api keys are saved | String | `your-path/Flowise/packages/server` |
| EXECUTION_MODE | Whether predictions run in their own process or the main process | Enum String: `child`, `main` | `main` |
| TOOL_FUNCTION_BUILTIN_DEP | NodeJS built-in modules to be used for Tool Function | String | |
| TOOL_FUNCTION_EXTERNAL_DEP | External modules to be used for Tool Function | String | |
| OVERRIDE_DATABASE | Override current database with default | Enum String: `true`, `false` | `true` |
| DATABASE_TYPE | Type of database to store the flowise data | Enum String: `sqlite`, `mysql`, `postgres` | `sqlite` |
| DATABASE_PATH | Location where database is saved (When DATABASE_TYPE is sqlite) | String | `your-home-dir/.flowise` |
| DATABASE_HOST | Host URL or IP address (When DATABASE_TYPE is not sqlite) | String | |
| DATABASE_PORT | Database port (When DATABASE_TYPE is not sqlite) | String | |
| DATABASE_USERNAME | Database username (When DATABASE_TYPE is not sqlite) | String | |
| DATABASE_PASSWORD | Database password (When DATABASE_TYPE is not sqlite) | String | |
| DATABASE_NAME | Database name (When DATABASE_TYPE is not sqlite) | String | |
| Variable | Description | Type | Default |
| -------------------------- | ---------------------------------------------------------------------------- | ------------------------------------------------ | ----------------------------------- |
| PORT | The HTTP port Flowise runs on | Number | 3000 |
| FLOWISE_USERNAME | Username to login | String | |
| FLOWISE_PASSWORD | Password to login | String | |
| DEBUG | Print logs from components | Boolean | |
| LOG_PATH | Location where log files are stored | String | `your-path/Flowise/logs` |
| LOG_LEVEL | Different levels of logs | Enum String: `error`, `info`, `verbose`, `debug` | `info` |
| APIKEY_PATH | Location where api keys are saved | String | `your-path/Flowise/packages/server` |
| EXECUTION_MODE | Whether predictions run in their own process or the main process | Enum String: `child`, `main` | `main` |
| TOOL_FUNCTION_BUILTIN_DEP | NodeJS built-in modules to be used for Tool Function | String | |
| TOOL_FUNCTION_EXTERNAL_DEP | External modules to be used for Tool Function | String | |
| OVERRIDE_DATABASE | Override current database with default | Enum String: `true`, `false` | `true` |
| DATABASE_TYPE | Type of database to store the flowise data | Enum String: `sqlite`, `mysql`, `postgres` | `sqlite` |
| DATABASE_PATH | Location where database is saved (When DATABASE_TYPE is sqlite) | String | `your-home-dir/.flowise` |
| DATABASE_HOST | Host URL or IP address (When DATABASE_TYPE is not sqlite) | String | |
| DATABASE_PORT | Database port (When DATABASE_TYPE is not sqlite) | String | |
| DATABASE_USERNAME | Database username (When DATABASE_TYPE is not sqlite) | String | |
| DATABASE_PASSWORD | Database password (When DATABASE_TYPE is not sqlite) | String | |
| DATABASE_NAME | Database name (When DATABASE_TYPE is not sqlite) | String | |
| PASSPHRASE | Passphrase used to create encryption key | String | `MYPASSPHRASE` |
| SECRETKEY_PATH | Location where encryption key (used to encrypt/decrypt credentials) is saved | String | `your-path/Flowise/packages/server` |

You can also specify the env variables when using `npx`. For example:

Expand Down
14 changes: 8 additions & 6 deletions docker/.env.example
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
PORT=3000
OVERRIDE_DATABASE=true
DATABASE_TYPE=sqlite
PASSPHRASE=MYPASSPHRASE # Passphrase used to create encryption key
DATABASE_PATH=/root/.flowise
# When database is not sqlite
APIKEY_PATH=/root/.flowise
SECRETKEY_PATH=/root/.flowise
LOG_PATH=/root/.flowise/logs

# DATABASE_TYPE=postgres
# DATABASE_PORT=""
# DATABASE_HOST=""
# DATABASE_NAME="flowise"
# DATABASE_USER=""
# DATABASE_PASSWORD=""
# OVERRIDE_DATABASE=true

APIKEY_PATH=/root/.flowise
LOG_PATH=/root/.flowise/logs
# FLOWISE_USERNAME=user
# FLOWISE_PASSWORD=1234
# DEBUG=true
# LOG_LEVEL=debug (error | warn | info | verbose | debug)
# EXECUTION_MODE=child or main
# EXECUTION_MODE=main (child | main)
# TOOL_FUNCTION_BUILTIN_DEP=crypto,fs
# TOOL_FUNCTION_EXTERNAL_DEP=moment,lodash
3 changes: 2 additions & 1 deletion docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ Starts Flowise from [DockerHub Image](https://hub.docker.com/repository/docker/f
## 🌱 Env Variables
If you like to persist your data (flows, logs, apikeys), set these variables in the `.env` file inside `docker` folder:
If you like to persist your data (flows, logs, apikeys, credentials), set these variables in the `.env` file inside `docker` folder:
- DATABASE_PATH=/root/.flowise
- APIKEY_PATH=/root/.flowise
- LOG_PATH=/root/.flowise/logs
- SECRETKEY_PATH=/root/.flowise
Flowise also support different environment variables to configure your instance. Read [more](https://docs.flowiseai.com/environment-variables)
4 changes: 3 additions & 1 deletion docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ services:
restart: always
environment:
- PORT=${PORT}
- PASSPHRASE=${PASSPHRASE}
- FLOWISE_USERNAME=${FLOWISE_USERNAME}
- FLOWISE_PASSWORD=${FLOWISE_PASSWORD}
- DEBUG=${DEBUG}
- DATABASE_PATH=${DATABASE_PATH}
- APIKEY_PATH=${APIKEY_PATH}
- LOG_PATH=${LOG_PATH}
- SECRETKEY_PATH=${SECRETKEY_PATH}
- LOG_LEVEL=${LOG_LEVEL}
- LOG_PATH=${LOG_PATH}
- EXECUTION_MODE=${EXECUTION_MODE}
ports:
- '${PORT}:${PORT}'
Expand Down
27 changes: 27 additions & 0 deletions packages/components/credentials/AirtableApi.credential.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { INodeParams, INodeCredential } from '../src/Interface'

class AirtableApi implements INodeCredential {
label: string
name: string
version: number
description: string
inputs: INodeParams[]

constructor() {
this.label = 'Airtable API'
this.name = 'airtableApi'
this.version = 1.0
this.description =
'Refer to <a target="_blank" href="https://support.airtable.com/docs/creating-and-using-api-keys-and-access-tokens">official guide</a> on how to get accessToken on Airtable'
this.inputs = [
{
label: 'Access Token',
name: 'accessToken',
type: 'password',
placeholder: '<AIRTABLE_ACCESS_TOKEN>'
}
]
}
}

module.exports = { credClass: AirtableApi }
23 changes: 23 additions & 0 deletions packages/components/credentials/AnthropicApi.credential.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { INodeParams, INodeCredential } from '../src/Interface'

class AnthropicApi implements INodeCredential {
label: string
name: string
version: number
inputs: INodeParams[]

constructor() {
this.label = 'Anthropic API'
this.name = 'anthropicApi'
this.version = 1.0
this.inputs = [
{
label: 'Anthropic Api Key',
name: 'anthropicApiKey',
type: 'password'
}
]
}
}

module.exports = { credClass: AnthropicApi }
47 changes: 47 additions & 0 deletions packages/components/credentials/AzureOpenAIApi.credential.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { INodeParams, INodeCredential } from '../src/Interface'

class AzureOpenAIApi implements INodeCredential {
label: string
name: string
version: number
description: string
inputs: INodeParams[]

constructor() {
this.label = 'Azure OpenAI API'
this.name = 'azureOpenAIApi'
this.version = 1.0
this.description =
'Refer to <a target="_blank" href="https://azure.microsoft.com/en-us/products/cognitive-services/openai-service">official guide</a> of how to use Azure OpenAI service'
this.inputs = [
{
label: 'Azure OpenAI Api Key',
name: 'azureOpenAIApiKey',
type: 'password',
description: `Refer to <a target="_blank" href="https://learn.microsoft.com/en-us/azure/cognitive-services/openai/quickstart?tabs=command-line&pivots=rest-api#set-up">official guide</a> on how to create API key on Azure OpenAI`
},
{
label: 'Azure OpenAI Api Instance Name',
name: 'azureOpenAIApiInstanceName',
type: 'string',
placeholder: 'YOUR-INSTANCE-NAME'
},
{
label: 'Azure OpenAI Api Deployment Name',
name: 'azureOpenAIApiDeploymentName',
type: 'string',
placeholder: 'YOUR-DEPLOYMENT-NAME'
},
{
label: 'Azure OpenAI Api Version',
name: 'azureOpenAIApiVersion',
type: 'string',
placeholder: '2023-06-01-preview',
description:
'Description of Supported API Versions. Please refer <a target="_blank" href="https://learn.microsoft.com/en-us/azure/cognitive-services/openai/reference#chat-completions">examples</a>'
}
]
}
}

module.exports = { credClass: AzureOpenAIApi }
24 changes: 24 additions & 0 deletions packages/components/credentials/BraveSearchApi.credential.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { INodeParams, INodeCredential } from '../src/Interface'

class BraveSearchApi implements INodeCredential {
label: string
name: string
version: number
description: string
inputs: INodeParams[]

constructor() {
this.label = 'Brave Search API'
this.name = 'braveSearchApi'
this.version = 1.0
this.inputs = [
{
label: 'BraveSearch Api Key',
name: 'braveApiKey',
type: 'password'
}
]
}
}

module.exports = { credClass: BraveSearchApi }
23 changes: 23 additions & 0 deletions packages/components/credentials/CohereApi.credential.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { INodeParams, INodeCredential } from '../src/Interface'

class CohereApi implements INodeCredential {
label: string
name: string
version: number
inputs: INodeParams[]

constructor() {
this.label = 'Cohere API'
this.name = 'cohereApi'
this.version = 1.0
this.inputs = [
{
label: 'Cohere Api Key',
name: 'cohereApiKey',
type: 'password'
}
]
}
}

module.exports = { credClass: CohereApi }
33 changes: 33 additions & 0 deletions packages/components/credentials/ConfluenceApi.credential.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { INodeParams, INodeCredential } from '../src/Interface'

class ConfluenceApi implements INodeCredential {
label: string
name: string
version: number
description: string
inputs: INodeParams[]

constructor() {
this.label = 'Confluence API'
this.name = 'confluenceApi'
this.version = 1.0
this.description =
'Refer to <a target="_blank" href="https://support.atlassian.com/confluence-cloud/docs/manage-oauth-access-tokens/">official guide</a> on how to get accessToken on Confluence'
this.inputs = [
{
label: 'Access Token',
name: 'accessToken',
type: 'password',
placeholder: '<CONFLUENCE_ACCESS_TOKEN>'
},
{
label: 'Username',
name: 'username',
type: 'string',
placeholder: '<CONFLUENCE_USERNAME>'
}
]
}
}

module.exports = { credClass: ConfluenceApi }
29 changes: 29 additions & 0 deletions packages/components/credentials/DynamodbMemoryApi.credential.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { INodeParams, INodeCredential } from '../src/Interface'

class DynamodbMemoryApi implements INodeCredential {
label: string
name: string
version: number
description: string
inputs: INodeParams[]

constructor() {
this.label = 'DynamodbMemory API'
this.name = 'dynamodbMemoryApi'
this.version = 1.0
this.inputs = [
{
label: 'Access Key',
name: 'accessKey',
type: 'password'
},
{
label: 'Secret Access Key',
name: 'secretAccessKey',
type: 'password'
}
]
}
}

module.exports = { credClass: DynamodbMemoryApi }
27 changes: 27 additions & 0 deletions packages/components/credentials/FigmaApi.credential.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { INodeParams, INodeCredential } from '../src/Interface'

class FigmaApi implements INodeCredential {
label: string
name: string
version: number
description: string
inputs: INodeParams[]

constructor() {
this.label = 'Figma API'
this.name = 'figmaApi'
this.version = 1.0
this.description =
'Refer to <a target="_blank" href="https://www.figma.com/developers/api#access-tokens">official guide</a> on how to get accessToken on Figma'
this.inputs = [
{
label: 'Access Token',
name: 'accessToken',
type: 'password',
placeholder: '<FIGMA_ACCESS_TOKEN>'
}
]
}
}

module.exports = { credClass: FigmaApi }
27 changes: 27 additions & 0 deletions packages/components/credentials/GithubApi.credential.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { INodeParams, INodeCredential } from '../src/Interface'

class GithubApi implements INodeCredential {
label: string
name: string
version: number
description: string
inputs: INodeParams[]

constructor() {
this.label = 'Github API'
this.name = 'githubApi'
this.version = 1.0
this.description =
'Refer to <a target="_blank" href="https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens">official guide</a> on how to get accessToken on Github'
this.inputs = [
{
label: 'Access Token',
name: 'accessToken',
type: 'password',
placeholder: '<GITHUB_ACCESS_TOKEN>'
}
]
}
}

module.exports = { credClass: GithubApi }
Loading

0 comments on commit a817ab6

Please sign in to comment.