diff --git a/Dockerfile b/Dockerfile index 8d4518ea8..77eaa9d65 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 diff --git a/README.md b/README.md index 067a6de91..dff890ff1 100644 --- a/README.md +++ b/README.md @@ -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) @@ -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 @@ -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 diff --git a/docker/.env.example b/docker/.env.example index 2f0e5571a..f32111966 100644 --- a/docker/.env.example +++ b/docker/.env.example @@ -1,3 +1,3 @@ PORT=3000 -USERNAME=user -PASSWORD=1234 \ No newline at end of file +# FLOWISE_USERNAME=user +# FLOWISE_PASSWORD=1234 diff --git a/docker/README.md b/docker/README.md index 57f747d37..7f991a042 100644 --- a/docker/README.md +++ b/docker/README.md @@ -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) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 7d142cb8a..c776f96e2 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -6,6 +6,8 @@ services: restart: always environment: - PORT=${PORT} + - FLOWISE_USERNAME=${FLOWISE_USERNAME} + - FLOWISE_PASSWORD=${FLOWISE_PASSWORD} ports: - '${PORT}:${PORT}' volumes: diff --git a/packages/components/src/index.ts b/packages/components/src/index.ts index d04f5bf61..ae2e380ee 100644 --- a/packages/components/src/index.ts +++ b/packages/components/src/index.ts @@ -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' diff --git a/packages/server/.env.example b/packages/server/.env.example index 2131b8d15..fd82c096c 100644 --- a/packages/server/.env.example +++ b/packages/server/.env.example @@ -1,4 +1,4 @@ PORT=3000 -# USERNAME=user -# PASSWORD=1234 +# FLOWISE_USERNAME=user +# FLOWISE_PASSWORD=1234 # EXECUTION_MODE=child or main \ No newline at end of file diff --git a/packages/server/README.md b/packages/server/README.md index 1915863b9..2cdf41d1c 100644 --- a/packages/server/README.md +++ b/packages/server/README.md @@ -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 diff --git a/packages/server/package.json b/packages/server/package.json index 4bf0a250e..f68db1238 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -13,8 +13,7 @@ "dist", "npm-shrinkwrap.json", "oclif.manifest.json", - "oauth2.html", - ".env" + "oauth2.html" ], "oclif": { "bin": "flowise", diff --git a/packages/server/src/commands/start.ts b/packages/server/src/commands/start.ts index 96456f265..a3ee561ad 100644 --- a/packages/server/src/commands/start.ts +++ b/packages/server/src/commands/start.ts @@ -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, @@ -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() { @@ -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 { diff --git a/packages/server/src/index.ts b/packages/server/src/index.ts index 59dfe3cfb..548c27e9d 100644 --- a/packages/server/src/index.ts +++ b/packages/server/src/index.ts @@ -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 } }) diff --git a/packages/ui/src/api/client.js b/packages/ui/src/api/client.js index cafdf0b3a..8235bde4c 100644 --- a/packages/ui/src/api/client.js +++ b/packages/ui/src/api/client.js @@ -14,8 +14,8 @@ apiClient.interceptors.request.use(function (config) { if (username && password) { config.auth = { - username: username.toLocaleLowerCase(), - password: password.toLocaleLowerCase() + username, + password } }