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
b20ec058
Commit
b20ec058
authored
May 21, 2024
by
Jun Siang Cheah
Browse files
refac: only create space admin user when configured
parent
889a2fd7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
14 deletions
+18
-14
backend/start.sh
backend/start.sh
+18
-14
No files found.
backend/start.sh
View file @
b20ec058
...
@@ -39,20 +39,24 @@ if [ -n "$SPACE_ID" ]; then
...
@@ -39,20 +39,24 @@ if [ -n "$SPACE_ID" ]; then
echo
"Copying litellm_config.yaml to the desired location with specified ownership..."
echo
"Copying litellm_config.yaml to the desired location with specified ownership..."
cp
-f
./space/litellm_config.yaml ./data/litellm/config.yaml
cp
-f
./space/litellm_config.yaml ./data/litellm/config.yaml
WEBUI_SECRET_KEY
=
"
$WEBUI_SECRET_KEY
"
uvicorn main:app
--host
"
$HOST
"
--port
"
$PORT
"
--forwarded-allow-ips
'*'
&
if
[
-n
"
$ADMIN_USER_EMAIL
"
]
&&
[
-n
"
$ADMIN_USER_PASSWORD
"
]
;
then
webui_pid
=
$!
echo
"Admin user configured, creating"
echo
"Waiting for webui to start..."
WEBUI_SECRET_KEY
=
"
$WEBUI_SECRET_KEY
"
uvicorn main:app
--host
"
$HOST
"
--port
"
$PORT
"
--forwarded-allow-ips
'*'
&
while
!
curl
-s
http://localhost:8080/health
>
/dev/null
;
do
webui_pid
=
$!
sleep
1
echo
"Waiting for webui to start..."
done
while
!
curl
-s
http://localhost:8080/health
>
/dev/null
;
do
echo
"Creating admin user..."
sleep
1
curl
\
done
-X
POST
"http://localhost:8080/api/v1/auths/signup"
\
echo
"Creating admin user..."
-H
"accept: application/json"
\
curl
\
-H
"Content-Type: application/json"
\
-X
POST
"http://localhost:8080/api/v1/auths/signup"
\
-d
"{
\"
email
\"
:
\"
${
ADMIN_USER_EMAIL
}
\"
,
\"
password
\"
:
\"
${
ADMIN_USER_PASSWORD
}
\"
,
\"
name
\"
:
\"
Admin
\"
}"
-H
"accept: application/json"
\
echo
"Shutting down webui..."
-H
"Content-Type: application/json"
\
kill
$webui_pid
-d
"{
\"
email
\"
:
\"
${
ADMIN_USER_EMAIL
}
\"
,
\"
password
\"
:
\"
${
ADMIN_USER_PASSWORD
}
\"
,
\"
name
\"
:
\"
Admin
\"
}"
echo
"Shutting down webui..."
kill
$webui_pid
fi
export
WEBUI_URL
=
${
SPACE_HOST
}
export
WEBUI_URL
=
${
SPACE_HOST
}
fi
fi
...
...
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