Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
814fbb73
Commit
814fbb73
authored
Jun 02, 2024
by
Timothy J. Baek
Browse files
feat: RESET_CONFIG_ON_START
parent
3d74c04f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
+11
-0
backend/config.py
backend/config.py
+11
-0
No files found.
backend/config.py
View file @
814fbb73
...
@@ -180,6 +180,17 @@ WEBUI_BUILD_HASH = os.environ.get("WEBUI_BUILD_HASH", "dev-build")
...
@@ -180,6 +180,17 @@ WEBUI_BUILD_HASH = os.environ.get("WEBUI_BUILD_HASH", "dev-build")
DATA_DIR
=
Path
(
os
.
getenv
(
"DATA_DIR"
,
BACKEND_DIR
/
"data"
)).
resolve
()
DATA_DIR
=
Path
(
os
.
getenv
(
"DATA_DIR"
,
BACKEND_DIR
/
"data"
)).
resolve
()
FRONTEND_BUILD_DIR
=
Path
(
os
.
getenv
(
"FRONTEND_BUILD_DIR"
,
BASE_DIR
/
"build"
)).
resolve
()
FRONTEND_BUILD_DIR
=
Path
(
os
.
getenv
(
"FRONTEND_BUILD_DIR"
,
BASE_DIR
/
"build"
)).
resolve
()
RESET_CONFIG_ON_START
=
(
os
.
environ
.
get
(
"RESET_CONFIG_ON_START"
,
"False"
).
lower
()
==
"true"
)
if
RESET_CONFIG_ON_START
:
try
:
os
.
remove
(
f
"
{
DATA_DIR
}
/config.json"
)
with
open
(
f
"
{
DATA_DIR
}
/config.json"
,
"w"
)
as
f
:
f
.
write
(
"{}"
)
except
:
pass
try
:
try
:
CONFIG_DATA
=
json
.
loads
((
DATA_DIR
/
"config.json"
).
read_text
())
CONFIG_DATA
=
json
.
loads
((
DATA_DIR
/
"config.json"
).
read_text
())
except
:
except
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment