forked from OKEAMAH/frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentrypoint.sh
More file actions
executable file
·68 lines (54 loc) · 1.46 KB
/
entrypoint.sh
File metadata and controls
executable file
·68 lines (54 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/bash
export_envs_from_preset() {
if [ -z "$ENVS_PRESET" ]; then
return
fi
if [ "$ENVS_PRESET" = "none" ]; then
return
fi
local preset_file="./configs/envs/.env.$ENVS_PRESET"
if [ ! -f "$preset_file" ]; then
return
fi
local blacklist=(
"NEXT_PUBLIC_APP_PROTOCOL"
"NEXT_PUBLIC_APP_HOST"
"NEXT_PUBLIC_APP_PORT"
"NEXT_PUBLIC_APP_ENV"
"NEXT_PUBLIC_API_WEBSOCKET_PROTOCOL"
)
while IFS='=' read -r name value; do
name="${name#"${name%%[![:space:]]*}"}" # Trim leading whitespace
if [[ -n $name && $name == "NEXT_PUBLIC_"* && ! "${blacklist[*]}" =~ "$name" ]]; then
export "$name"="$value"
fi
done < <(grep "^[^#;]" "$preset_file")
}
# If there is a preset, load the environment variables from the its file
export_envs_from_preset
# Download external assets
./download_assets.sh ./public/assets/configs
# Check run-time ENVs values
if [ "$SKIP_ENVS_VALIDATION" != "true" ]; then
./validate_envs.sh
if [ $? -ne 0 ]; then
exit 1
fi
else
echo "😱 Skipping ENVs validation."
echo
fi
# Generate favicons bundle
./favicon_generator.sh
if [ $? -ne 0 ]; then
echo "👎 Unable to generate favicons bundle."
else
echo "👍 Favicons bundle successfully generated."
fi
echo
# Create envs.js file with run-time environment variables for the client app
./make_envs_script.sh
# Print list of enabled features
node ./feature-reporter.js
echo "Starting Next.js application"
exec "$@"