-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: mount config file instead of passing env
- Loading branch information
1 parent
d5e6b4b
commit cd327c0
Showing
6 changed files
with
37 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,5 @@ | |
.git/ | ||
|
||
uoj_data/ | ||
|
||
.config.local.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.idea | ||
uoj_data/ | ||
.php-cs-fixer.cache | ||
.config.local.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
|
||
echo "==> Preparing config file" | ||
|
||
genRandStr(){ | ||
cat /dev/urandom | tr -dc [:alnum:] | head -c $1 | ||
} | ||
|
||
# 复制配置文件 | ||
cp web/app/.default-config.php .config.local.php | ||
echo "==> Copied default config file" | ||
|
||
# 替换配置文件中的 salt | ||
sed -i -e "s/salt0/$(genRandStr 32)/g" \ | ||
-e "s/salt1/$(genRandStr 16)/g" \ | ||
-e "s/salt2/$(genRandStr 16)/g" \ | ||
-e "s/salt3/$(genRandStr 16)/g" \ | ||
.config.local.php | ||
echo "==> Replaced salt in config file" | ||
|
||
# 替换配置文件中的 _httpHost_ | ||
sed -i -e "s/'_httpHost_'/UOJContext::httpHost()/g" .config.local.php | ||
echo "==> Replaced _httpHost_ in config file" | ||
|
||
echo "" | ||
echo "==> Done, config file is '.config.local.php'" | ||
echo "==> Please modify the config file according to your needs" | ||
echo "==> Then run 'docker-compose up -d' to start the service" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters