@@ -192,6 +192,7 @@ configure() {
192192}
193193
194194resetEnv () {
195+ COMPOSE_PROFILES=" "
195196 CONFIG_STORAGE=" "
196197 FILE_ROOT_DIR=" "
197198 NACOS_SERVER_URL=" "
@@ -276,12 +277,23 @@ configureFileStorageByArgs() {
276277
277278 FILE_ROOT_DIR=" ${CONFIG_URL# file:// } "
278279 if [ " $OS " == " windows" ]; then
279- if [[ " $FILE_ROOT_DIR " == * " :" * ]]; then
280- FILE_ROOT_DIR=" ${FILE_ROOT_DIR// \\ // } "
281- else
282- FILE_ROOT_DIR=" /${FILE_ROOT_DIR// \\ // } "
280+ # Fix path separators
281+ FILE_ROOT_DIR=" ${FILE_ROOT_DIR// \\ // } "
282+ if [[ " $FILE_ROOT_DIR " == " ." * ]] || [[ " $FILE_ROOT_DIR " == " ~/" * ]]; then
283+ # A relatpath ive or user home based path. Do nothing.
284+ :
285+ elif [[ " $FILE_ROOT_DIR " != " /" * ]]; then
286+ echo ' Invalid file URL. Relative path must begin with a ".". Absolute path must begin with a "/" or "~/".'
287+ exit -1
288+ elif [[ " $FILE_ROOT_DIR " == * " :" * ]]; then
289+ FILE_ROOT_DIR=" ${FILE_ROOT_DIR#/ } "
283290 fi
284291 fi
292+ if [[ " $FILE_ROOT_DIR " == ' ~/' * ]]; then
293+ # A user home based path.
294+ FILE_ROOT_DIR=" ${HOME}${FILE_ROOT_DIR# \~ } "
295+ fi
296+ echo " Root: $FILE_ROOT_DIR "
285297 mkdir -p " $FILE_ROOT_DIR " && cd " $_ "
286298 if [ $? -ne 0 ]; then
287299 echo " Unable to create/access the config folder. Please fix it or choose another one."
@@ -415,7 +427,9 @@ configureFileStorage() {
415427 readNonEmpty " Please input the root path of config folder: "
416428 FILE_ROOT_DIR=" $input "
417429 if [ " $OS " == " windows" ]; then
418- if [[ " $FILE_ROOT_DIR " == " /" * ]]; then
430+ if [[ " $FILE_ROOT_DIR " == " ." * ]]; then
431+ :
432+ elif [[ " $FILE_ROOT_DIR " == " /" * ]]; then
419433 :
420434 elif [[ " $FILE_ROOT_DIR " == * " :" * ]]; then
421435 FILE_ROOT_DIR=" ${FILE_ROOT_DIR// \\ // } "
@@ -474,7 +488,7 @@ outputUsage() {
474488 -a, --auto-start start Higress after configuration
475489 -c, --config-url=URL URL of the config storage
476490 Use Nacos with format: nacos://192.168.0.1:8848
477- Use local files with format: file://opt/higress/conf
491+ Use local files with format: file:/// opt/higress/conf
478492 --use-builtin-nacos use the built-in Nacos service instead of
479493 an external one to store configurations
480494 --nacos-ns=NACOS-NAMESPACE
0 commit comments