Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add dynamic key values to secrets.properties in idx template #1814

Merged
merged 2 commits into from
Sep 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions open-in-idx-template/idx-template.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,21 @@
chmod -R +w "$WS_NAME"
mkdir -p "$WS_NAME/.idx/"

# Create a secrets.properties file in the repo and replace the MAPS_API_KEY property with said value
# Create a secrets.properties file in the repo
touch $WS_NAME/secrets.properties
echo "MAPS_API_KEY=\"${apikey}\"" > $WS_NAME/secrets.properties

# Create a secrets.properties variable for each key type in the
local.defaults.properties file

while IFS= read -r line || [[ -n "$line" ]]; do
# Check that an "=" exists in the line
if [[ $line == *"="* ]]; then
# Extract the variable name
keyVar=$(echo "$line" | cut -d '=' -f 1)
# Define new variable in secrets file
echo "$keyVar=\"${apikey}\"" >> $WS_NAME/secrets.properties
fi
done < $WS_NAME/local.defaults.properties

# We create a dev.nix that builds the subproject specified at template instantiation
launch_activity=${launchactivity} j2 --format=env ${./devNix.j2} -o $WS_NAME/.idx/dev.nix
Expand Down
Loading