| 
									
										
										
										
											2023-03-21 19:39:28 +08:00
										 |  |  | #!/usr/bin/env bash | 
					
						
							|  |  |  | SCRIPT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #set -x | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | UAA_PATH=${1:?First parameter is the directory env and config files are relative to} | 
					
						
							|  |  |  | ENV_FILE=${2:?Second parameter is a comma-separated list of .env file which has exported template variables} | 
					
						
							|  |  |  | FINAL_CONFIG_FILE=${3:?Forth parameter is the name of the final config file. It is relative to where this script is run from} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | source $ENV_FILE | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-31 15:51:22 +08:00
										 |  |  | parentdir="$(dirname "$FINAL_CONFIG_FILE")" | 
					
						
							|  |  |  | mkdir -p $parentdir | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-21 19:39:28 +08:00
										 |  |  | echo "" > $FINAL_CONFIG_FILE | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-05-02 23:29:42 +08:00
										 |  |  | for f in $($SCRIPT/find-template-files "${PROFILES}" $UAA_PATH "uaa" "yml") | 
					
						
							| 
									
										
										
										
											2023-03-21 19:39:28 +08:00
										 |  |  | do | 
					
						
							|  |  |  |   envsubst < $f  >> $FINAL_CONFIG_FILE | 
					
						
							|  |  |  | done |