Skip to content

Commit

Permalink
change USERNAME and PASSWORD to FLOWISE_USERNAME and FLOWISE_PASSWORD…
Browse files Browse the repository at this point in the history
… to prevent conflict with machine env variables
  • Loading branch information
HenryHengZJ committed May 27, 2023
1 parent dc4fe13 commit 0f0d887
Show file tree
Hide file tree
Showing 12 changed files with 29 additions and 37 deletions.
3 changes: 0 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
# Run image
# 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
RUN apk add --update libc6-compat

Expand Down
14 changes: 4 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Drag & drop UI to build your customized LLM flow using [LangchainJS](https://git
With username & password

```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)
Expand All @@ -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
```

With username & password

```bash
docker run -d -e USERNAME=user -e PASSWORD=1234 --name flowise -p 3000:3000 flowise
```

3. Stop image:
```bash
docker stop flowise
Expand Down Expand Up @@ -119,11 +113,11 @@ Flowise has 3 different modules in a single mono repository.

## 🔒 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
PASSWORD=1234
FLOWISE_USERNAME=user
FLOWISE_PASSWORD=1234
```
## 📖 Documentation
Expand Down
4 changes: 2 additions & 2 deletions docker/.env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
PORT=3000
USERNAME=user
PASSWORD=1234
# FLOWISE_USERNAME=user
# FLOWISE_PASSWORD=1234
8 changes: 4 additions & 4 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ Starts Flowise from [DockerHub Image](https://hub.docker.com/repository/docker/f

## With Authrorization

1. Create `.env` file and specify the `PORT`, `USERNAME`, and `PASSWORD` (refer to `.env.example`)
2. Pass `USERNAME` and `PASSWORD` to the `docker-compose.yml` file:
1. Create `.env` file and specify the `PORT`, `FLOWISE_USERNAME`, and `FLOWISE_PASSWORD` (refer to `.env.example`)
2. Pass `FLOWISE_USERNAME` and `FLOWISE_PASSWORD` to the `docker-compose.yml` file:
```
environment:
- PORT=${PORT}
- USERNAME=${USERNAME}
- PASSWORD=${PASSWORD}
- FLOWISE_USERNAME=${FLOWISE_USERNAME}
- FLOWISE_PASSWORD=${FLOWISE_PASSWORD}
```
3. `docker-compose up -d`
4. Open [http://localhost:3000](http://localhost:3000)
Expand Down
2 changes: 2 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ services:
restart: always
environment:
- PORT=${PORT}
- FLOWISE_USERNAME=${FLOWISE_USERNAME}
- FLOWISE_PASSWORD=${FLOWISE_PASSWORD}
ports:
- '${PORT}:${PORT}'
volumes:
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import dotenv from 'dotenv'
import path from 'path'

const envPath = path.join(__dirname, '..', '..', '.env')
dotenv.config({ path: envPath })
dotenv.config({ path: envPath, override: true })

export * from './Interface'
export * from './utils'
4 changes: 2 additions & 2 deletions packages/server/.env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PORT=3000
# USERNAME=user
# PASSWORD=1234
# FLOWISE_USERNAME=user
# FLOWISE_PASSWORD=1234
# EXECUTION_MODE=child or main
6 changes: 3 additions & 3 deletions packages/server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ Drag & drop UI to build your customized LLM flow using [LangchainJS](https://git

## 🔒 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
PASSWORD=1234
FLOWISE_USERNAME=user
FLOWISE_PASSWORD=1234
```
## 📖 Documentation
Expand Down
3 changes: 1 addition & 2 deletions packages/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
"dist",
"npm-shrinkwrap.json",
"oclif.manifest.json",
"oauth2.html",
".env"
"oauth2.html"
],
"oclif": {
"bin": "flowise",
Expand Down
10 changes: 5 additions & 5 deletions packages/server/src/commands/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as Server from '../index'
import * as DataSource from '../DataSource'
import dotenv from 'dotenv'

dotenv.config({ path: path.join(__dirname, '..', '..', '.env') })
dotenv.config({ path: path.join(__dirname, '..', '..', '.env'), override: true })

enum EXIT_CODE {
SUCCESS = 0,
Expand All @@ -15,8 +15,8 @@ let processExitCode = EXIT_CODE.SUCCESS
export default class Start extends Command {
static args = []
static flags = {
USERNAME: Flags.string(),
PASSWORD: Flags.string()
FLOWISE_USERNAME: Flags.string(),
FLOWISE_PASSWORD: Flags.string()
}

async stopProcess() {
Expand Down Expand Up @@ -48,8 +48,8 @@ export default class Start extends Command {
})

const { flags } = await this.parse(Start)
if (flags.USERNAME) process.env.USERNAME = flags.USERNAME
if (flags.PASSWORD) process.env.PASSWORD = flags.PASSWORD
if (flags.FLOWISE_USERNAME) process.env.FLOWISE_USERNAME = flags.FLOWISE_USERNAME
if (flags.FLOWISE_PASSWORD) process.env.FLOWISE_PASSWORD = flags.FLOWISE_PASSWORD

await (async () => {
try {
Expand Down
6 changes: 3 additions & 3 deletions packages/server/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ export class App {
// Allow access from *
this.app.use(cors())

if (process.env.USERNAME && process.env.PASSWORD) {
const username = process.env.USERNAME.toLocaleLowerCase()
const password = process.env.PASSWORD.toLocaleLowerCase()
if (process.env.FLOWISE_USERNAME && process.env.FLOWISE_PASSWORD) {
const username = process.env.FLOWISE_USERNAME
const password = process.env.FLOWISE_PASSWORD
const basicAuthMiddleware = basicAuth({
users: { [username]: password }
})
Expand Down
4 changes: 2 additions & 2 deletions packages/ui/src/api/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ apiClient.interceptors.request.use(function (config) {

if (username && password) {
config.auth = {
username: username.toLocaleLowerCase(),
password: password.toLocaleLowerCase()
username,
password
}
}

Expand Down

0 comments on commit 0f0d887

Please sign in to comment.