change USERNAME and PASSWORD to FLOWISE_USERNAME and FLOWISE_PASSWORD to prevent conflict with machine env variables

This commit is contained in:
Henry 2023-05-27 20:23:18 +01:00
parent dc4fe13b12
commit 0f0d887f78
12 changed files with 29 additions and 37 deletions

View File

@ -4,9 +4,6 @@
# Run image # Run image
# docker run -d -p 3000:3000 flowise # docker run -d -p 3000:3000 flowise
# Run image with authorization
# docker run -d -e USERNAME=user -e PASSWORD=1234 -p 3000:3000 flowise
FROM node:18-alpine FROM node:18-alpine
RUN apk add --update libc6-compat RUN apk add --update libc6-compat

View File

@ -22,7 +22,7 @@ Drag & drop UI to build your customized LLM flow using [LangchainJS](https://git
With username & password With username & password
```bash ```bash
npx flowise start --USERNAME=user --PASSWORD=1234 npx flowise start --FLOWISE_USERNAME=user --FLOWISE_PASSWORD=1234
``` ```
3. Open [http://localhost:3000](http://localhost:3000) 3. Open [http://localhost:3000](http://localhost:3000)
@ -49,12 +49,6 @@ Drag & drop UI to build your customized LLM flow using [LangchainJS](https://git
docker run -d --name flowise -p 3000:3000 flowise docker run -d --name flowise -p 3000:3000 flowise
``` ```
With username & password
```bash
docker run -d -e USERNAME=user -e PASSWORD=1234 --name flowise -p 3000:3000 flowise
```
3. Stop image: 3. Stop image:
```bash ```bash
docker stop flowise docker stop flowise
@ -119,11 +113,11 @@ Flowise has 3 different modules in a single mono repository.
## 🔒 Authentication ## 🔒 Authentication
To enable app level authentication, add `USERNAME` and `PASSWORD` to the `.env` file in `packages/server`: To enable app level authentication, add `FLOWISE_USERNAME` and `FLOWISE_PASSWORD` to the `.env` file in `packages/server`:
``` ```
USERNAME=user FLOWISE_USERNAME=user
PASSWORD=1234 FLOWISE_PASSWORD=1234
``` ```
## 📖 Documentation ## 📖 Documentation

View File

@ -1,3 +1,3 @@
PORT=3000 PORT=3000
USERNAME=user # FLOWISE_USERNAME=user
PASSWORD=1234 # FLOWISE_PASSWORD=1234

View File

@ -11,13 +11,13 @@ Starts Flowise from [DockerHub Image](https://hub.docker.com/repository/docker/f
## With Authrorization ## With Authrorization
1. Create `.env` file and specify the `PORT`, `USERNAME`, and `PASSWORD` (refer to `.env.example`) 1. Create `.env` file and specify the `PORT`, `FLOWISE_USERNAME`, and `FLOWISE_PASSWORD` (refer to `.env.example`)
2. Pass `USERNAME` and `PASSWORD` to the `docker-compose.yml` file: 2. Pass `FLOWISE_USERNAME` and `FLOWISE_PASSWORD` to the `docker-compose.yml` file:
``` ```
environment: environment:
- PORT=${PORT} - PORT=${PORT}
- USERNAME=${USERNAME} - FLOWISE_USERNAME=${FLOWISE_USERNAME}
- PASSWORD=${PASSWORD} - FLOWISE_PASSWORD=${FLOWISE_PASSWORD}
``` ```
3. `docker-compose up -d` 3. `docker-compose up -d`
4. Open [http://localhost:3000](http://localhost:3000) 4. Open [http://localhost:3000](http://localhost:3000)

View File

@ -6,6 +6,8 @@ services:
restart: always restart: always
environment: environment:
- PORT=${PORT} - PORT=${PORT}
- FLOWISE_USERNAME=${FLOWISE_USERNAME}
- FLOWISE_PASSWORD=${FLOWISE_PASSWORD}
ports: ports:
- '${PORT}:${PORT}' - '${PORT}:${PORT}'
volumes: volumes:

View File

@ -2,7 +2,7 @@ import dotenv from 'dotenv'
import path from 'path' import path from 'path'
const envPath = path.join(__dirname, '..', '..', '.env') const envPath = path.join(__dirname, '..', '..', '.env')
dotenv.config({ path: envPath }) dotenv.config({ path: envPath, override: true })
export * from './Interface' export * from './Interface'
export * from './utils' export * from './utils'

View File

@ -1,4 +1,4 @@
PORT=3000 PORT=3000
# USERNAME=user # FLOWISE_USERNAME=user
# PASSWORD=1234 # FLOWISE_PASSWORD=1234
# EXECUTION_MODE=child or main # EXECUTION_MODE=child or main

View File

@ -22,11 +22,11 @@ Drag & drop UI to build your customized LLM flow using [LangchainJS](https://git
## 🔒 Authentication ## 🔒 Authentication
To enable app level authentication, add `USERNAME` and `PASSWORD` to the `.env` file: To enable app level authentication, add `FLOWISE_USERNAME` and `FLOWISE_PASSWORD` to the `.env` file:
``` ```
USERNAME=user FLOWISE_USERNAME=user
PASSWORD=1234 FLOWISE_PASSWORD=1234
``` ```
## 📖 Documentation ## 📖 Documentation

View File

@ -13,8 +13,7 @@
"dist", "dist",
"npm-shrinkwrap.json", "npm-shrinkwrap.json",
"oclif.manifest.json", "oclif.manifest.json",
"oauth2.html", "oauth2.html"
".env"
], ],
"oclif": { "oclif": {
"bin": "flowise", "bin": "flowise",

View File

@ -4,7 +4,7 @@ import * as Server from '../index'
import * as DataSource from '../DataSource' import * as DataSource from '../DataSource'
import dotenv from 'dotenv' import dotenv from 'dotenv'
dotenv.config({ path: path.join(__dirname, '..', '..', '.env') }) dotenv.config({ path: path.join(__dirname, '..', '..', '.env'), override: true })
enum EXIT_CODE { enum EXIT_CODE {
SUCCESS = 0, SUCCESS = 0,
@ -15,8 +15,8 @@ let processExitCode = EXIT_CODE.SUCCESS
export default class Start extends Command { export default class Start extends Command {
static args = [] static args = []
static flags = { static flags = {
USERNAME: Flags.string(), FLOWISE_USERNAME: Flags.string(),
PASSWORD: Flags.string() FLOWISE_PASSWORD: Flags.string()
} }
async stopProcess() { async stopProcess() {
@ -48,8 +48,8 @@ export default class Start extends Command {
}) })
const { flags } = await this.parse(Start) const { flags } = await this.parse(Start)
if (flags.USERNAME) process.env.USERNAME = flags.USERNAME if (flags.FLOWISE_USERNAME) process.env.FLOWISE_USERNAME = flags.FLOWISE_USERNAME
if (flags.PASSWORD) process.env.PASSWORD = flags.PASSWORD if (flags.FLOWISE_PASSWORD) process.env.FLOWISE_PASSWORD = flags.FLOWISE_PASSWORD
await (async () => { await (async () => {
try { try {

View File

@ -83,9 +83,9 @@ export class App {
// Allow access from * // Allow access from *
this.app.use(cors()) this.app.use(cors())
if (process.env.USERNAME && process.env.PASSWORD) { if (process.env.FLOWISE_USERNAME && process.env.FLOWISE_PASSWORD) {
const username = process.env.USERNAME.toLocaleLowerCase() const username = process.env.FLOWISE_USERNAME
const password = process.env.PASSWORD.toLocaleLowerCase() const password = process.env.FLOWISE_PASSWORD
const basicAuthMiddleware = basicAuth({ const basicAuthMiddleware = basicAuth({
users: { [username]: password } users: { [username]: password }
}) })

View File

@ -14,8 +14,8 @@ apiClient.interceptors.request.use(function (config) {
if (username && password) { if (username && password) {
config.auth = { config.auth = {
username: username.toLocaleLowerCase(), username,
password: password.toLocaleLowerCase() password
} }
} }