-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #238 from TykTechnologies/letz-license-update
License update script, instead of editing
- Loading branch information
Showing
2 changed files
with
27 additions
and
0 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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
.env | ||
.env.bak | ||
.DS_store | ||
.context-data | ||
.bootstrap | ||
|
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,26 @@ | ||
#!/bin/bash | ||
# | ||
# Use to update your licence key, instead of editing the file directly | ||
# Usage: run it with the license key as an input | ||
# | ||
# Prompt user for the new license key | ||
# | ||
if [ -z "$1" ]; then | ||
echo "Please provide the new license key as an argument." | ||
exit 1 | ||
fi | ||
|
||
new_license_key="$1" | ||
|
||
# Save copy before the update | ||
cp .env .env.bak | ||
|
||
# Update the DASHBOARD_LICENCE in .env with the new license key | ||
sed -e "s/^DASHBOARD_LICENCE=.*$/DASHBOARD_LICENCE=${new_license_key}/" .env > .env.output && mv .env.output .env | ||
|
||
# Check if sed command succeeded | ||
if [ $? -eq 0 ]; then | ||
echo "License key updated successfully" | ||
else | ||
echo "Failed to update the license key" | ||
fi |