Feat/startup config api (#518)

* feat: add api for config

* feat: add data service to client

* feat: update client pages with values from config endpoint

* test: update tests

* Update configurations and documentation to remove VITE_SHOW_GOOGLE_LOGIN_OPTION and change VITE_APP_TITLE to APP_TITLE

* include APP_TITLE with startup config

* Add test for new route

* update backend-review pipeline

* comment out test until we can figure out testing routes in CI

* update: .env.example

---------

Co-authored-by: fuegovic <32828263+fuegovic@users.noreply.github.com>
This commit is contained in:
Dan Orlando 2023-06-15 09:36:34 -07:00 committed by GitHub
parent 2da81db440
commit 3634d8691a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 419 additions and 75 deletions

View file

@ -60,7 +60,7 @@ let env = {};
const title = await askQuestion(
'Enter the app title (default: "LibreChat"): '
);
env['VITE_APP_TITLE'] = title || 'LibreChat';
env['APP_TITLE'] = title || 'LibreChat';
// Ask for OPENAI_API_KEY
const key = await askQuestion(

View file

@ -95,6 +95,7 @@ const removeEnvs = {
'SERVER_URL_PROD': 'remove',
'JWT_SECRET_DEV': 'remove', // Lets regen
'JWT_SECRET_PROD': 'remove', // Lets regen
'VITE_APP_TITLE': 'remove',
// Comments to remove:
'#JWT:': 'remove',
'# Add a secure secret for production if deploying to live domain.': 'remove',
@ -120,11 +121,10 @@ loader.addSecureEnvVar(rootEnvPath, 'JWT_SECRET', 32);
// Lets update the openai key name, not the best spot in the env file but who cares ¯\_(ツ)_/¯
loader.writeEnvFile(rootEnvPath, {'OPENAI_API_KEY': initEnv['OPENAI_KEY']})
// TODO: we need to copy over the value of: VITE_SHOW_GOOGLE_LOGIN_OPTION & VITE_APP_TITLE
// TODO: we need to copy over the value of: APP_TITLE
fs.appendFileSync(rootEnvPath, '\n\n##########################\n# Frontend Vite Variables:\n##########################\n');
const frontend = {
'VITE_APP_TITLE': initEnv['VITE_APP_TITLE'] || '"LibreChat"',
'VITE_SHOW_GOOGLE_LOGIN_OPTION': initEnv['VITE_SHOW_GOOGLE_LOGIN_OPTION'] || 'false',
'APP_TITLE': initEnv['VITE_APP_TITLE'] || '"LibreChat"',
'ALLOW_REGISTRATION': 'true'
}
loader.writeEnvFile(rootEnvPath, frontend)