-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
112 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
7 changes: 7 additions & 0 deletions
7
frontend/src/components/pages/admin/posting/CreatePostingShiftsPage.tsx
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,7 @@ | ||
import React from "react"; | ||
|
||
const CreatePostingShiftsPage = (): React.ReactElement => { | ||
return <div />; | ||
}; | ||
|
||
export default CreatePostingShiftsPage; |
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,21 @@ | ||
#!/bin/sh | ||
# update secret files if git pull on master resulted in new changes being merged locally | ||
|
||
branch=`git symbolic-ref HEAD` | ||
root_dir=`git rev-parse --show-toplevel` | ||
# must replace with actual vault_path and default_branch, can run setup.sh | ||
vault_path="" | ||
default_branch="" | ||
|
||
if [ $branch = "refs/heads/${default_branch}" ]; then | ||
if [ -f "${root_dir}/update_secret_files.py" ]; then | ||
vault kv get -format=json $vault_path | python "${root_dir}/update_secret_files.py" | ||
if [ $? -eq 0 ]; then | ||
echo "Successfully pulled secrets from Vault" | ||
else | ||
echo "An error occurred while pulling secrets from Vault" | ||
fi | ||
else | ||
echo "To automatically update secrets after git pull on default branch, place update_secret_files.py in repo root directory" | ||
fi | ||
fi |
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,2 @@ | ||
SECRET_KEY_FROM_VAULT_1=relative/path/to/secret/file1.env | ||
SECRET_KEY_FROM_VAULT_2=relative/path/to/secret/file2.env |
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,14 @@ | ||
#!/bin/bash | ||
|
||
vault_path_replacement_str="s|^vault_path=.*|vault_path=\"$1\"|g" | ||
default_branch_replacement_str="s|^default_branch=.*|default_branch=\"$2\"|g" | ||
|
||
# MacOS | ||
if [[ $OSTYPE =~ darwin.* ]]; then | ||
sed -i "" -e $vault_path_replacement_str ./hooks/post-merge | ||
sed -i "" -e $default_branch_replacement_str ./hooks/post-merge | ||
else | ||
sed -i $vault_path_replacement_str ./hooks/post-merge | ||
sed -i $default_branch_replacement_str ./hooks/post-merge | ||
fi | ||
cp ./hooks/post-merge ./.git/hooks/post-merge |
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,56 @@ | ||
import sys | ||
import json | ||
|
||
# Open secret.config file | ||
configFileNotFound = False | ||
try: | ||
configFile = open('secret.config') | ||
except Exception as e: | ||
print("File secret.config could not be opened in current directory.") | ||
print(e) | ||
configFileNotFound = True | ||
# Script will exit after checking if the Vault request is valid | ||
|
||
# Decode json result | ||
try: | ||
rawInput = ''.join(sys.stdin.readlines()) | ||
decodedJson = json.loads(rawInput) | ||
except Exception as e: | ||
print("Unable to retrieve secrets from Vault and obtain valid json result.") | ||
print("Please ensure you are authenticated and have supplied the correct path argument.") | ||
exit() | ||
|
||
# Extract the data field containting the secrets | ||
if "data" in decodedJson and "data" in decodedJson["data"]: | ||
data = decodedJson["data"]["data"] | ||
else: | ||
print("Unable to access the field data:{data:{}} from result which should contain the secrets.") | ||
print("Please ensure you are authenticated and have supplied the correct path argument.") | ||
exit() | ||
|
||
# Even if the config file is not found, it is useful to still indicate if the Vault request has any problems before exiting | ||
if configFileNotFound: | ||
exit() | ||
|
||
# Read all the secret file locations from secret.config | ||
locations = {} | ||
for line in configFile: | ||
key, val = line.rstrip().partition('=')[::2] | ||
if key in locations: | ||
print("Key <{keyName}> appeared more than once on configuration file. Ignoring second instance of the key.".format(keyName=key)) | ||
else: | ||
locations[key] = val | ||
configFile.close() | ||
|
||
# Write values to the secret file corresponding to their keys | ||
for key in data: | ||
if key in locations: | ||
try: | ||
f = open(locations[key], 'w') | ||
f.write(data[key]) | ||
f.close() | ||
except Exception as e: | ||
print("Could not write the values for key <{keyName}> to location <{locName}>".format(keyName=key, locName=locations[key])) | ||
print(e) | ||
else: | ||
print("File location for key <{keyName}> was not found.".format(keyName=key)) |
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,4 @@ | ||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. | ||
# yarn lockfile v1 | ||
|
||
|