Skip to content

Commit 4901ed4

Browse files
committed
config: Install SOPS
1 parent 85ab03a commit 4901ed4

File tree

7 files changed

+75
-24
lines changed

7 files changed

+75
-24
lines changed

.github/workflows/CD.yml

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,10 @@ jobs:
2424
uses: actions/setup-node@v1
2525
with:
2626
node-version: ${{ matrix.node-version }}
27+
- name: Install SOPS
28+
run: |
29+
apt-get install wget
30+
wget https://github.com/mozilla/sops/releases/download/v3.7.0/sops_3.7.0_amd64.deb
31+
dpkg -i sops_3.7.0_amd64.deb
32+
2733

28-
- name: Install Serverless
29-
run: npm install
30-
31-
- name: Sops Binary Installer
32-
uses: mdgreenwald/mozilla-sops-action@v1
33-
id: sops
34-
with:
35-
version: 'stable' # default is latest stable
36-
# - name: Install Serverless Plugins
37-
# run: make install-serverless-plugins
38-
39-
40-

.gitignore

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ appsettings.json
2424
local.settings.json
2525

2626
node_modules
27-
28-
2927
.idea/
3028
.vscode/
31-
serverless.yml
32-
.serverless
29+
.serverless
30+
keys.yml.bk

nodejs-functions/.sops.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
creation_rules:
2+
- path_regex: keys.yml.*
3+
azure_keyvault: https://time-tracker-secrets.vault.azure.net/keys/tt-functions-sops/021de58b06a1497881bbacf4c82b83d7

nodejs-functions/Makefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
SECRETS=keys.yml
12
help: Makefile
23
@sed -n 's/^## //p' $<
34

@@ -6,4 +7,10 @@ install-dependencies-nodejs:
67
cd src/handlers/automatic-clock-outs ; pwd ; $(MAKE) install
78

89
deploy:
9-
sls deploy
10+
sls deploy
11+
12+
sops-encrypt:
13+
sops -e -i ${SECRETS}
14+
15+
sops-decrypt:
16+
sops -e -i ${SECRETS}

nodejs-functions/keys.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
ENDPOINT: ENC[AES256_GCM,data:GfAgi2/21MBKXUC+CrDwxsJvaJ65dX0FfKJ4G5Vl27gpYgaCYJwv8V0x25KelFNP,iv:NJ7ojeG/Ri85CRKwhaUCRM1VX/3P07BFnLrGLzHirSo=,tag:UVlNV4G3i8naQI62AqDp4w==,type:str]
2+
KEY: ENC[AES256_GCM,data:w8ZR6sEoI2e8chEZD2H7QTsBq7kiWdueY0GUbbVL9u0C6FwDrPc15HRT8vtTriDDPSZ4eyVDfCki1iou3wTdXQGEbEP8WBnV5ip4AmY1vsLfRGmvjXCkWg==,iv:3aSbO780K3jfXGYMCVOQ1c1MP/w/+mmqqb8AFxeXXaI=,tag:L0uS2tAd1DBohxCpZLrEGQ==,type:str]
3+
CLIENT_ID: ENC[AES256_GCM,data:BoYtCKQmnSybAjkYYBY9kx93ArgoPqhG/5S/Uf6wLNECtQsX,iv:5OEuADHlba8Qi9gx0IRP0z5aeF1gRA8erAvcJ5QnM38=,tag:8APiGMSRz0YhvT8HxIbUZQ==,type:str]
4+
AUTHORITY: ENC[AES256_GCM,data:IZKxzFXzseYQM7eOb13/X3OcoZuqNejXXyW7E0SyYvOC1B2SFJqctiKRi+WlHh1FDbFmGrppN55LFilsK1JxAI1yDVn9UA==,iv:a5ssxFJ0Lj8nl2eLY0yjeQkR0xI3FDZ7Qsh4sHDm1BA=,tag:5pEMC1Vy/HqqS6GgoqqcWQ==,type:str]
5+
CLIENT_SECRET: ENC[AES256_GCM,data:I2+gds60a5ILuUxZEIO2wKRkyxd1qXZsFzf4FSG0NjQ=,iv:mfEGAzcsjVu1/sQEuGvIZ9UrbesEguS1ahj5afJi0ec=,tag:rMmu3in/iQcsonF7HJ3z+w==,type:str]
6+
SLACK_TOKEN_NOTIFY: ENC[AES256_GCM,data:4yuRzrkniHTWaaMqr2Qf5CaH4kvTXcTh1+8A98du3zKwycdsJMycxwLOqm7XDJa/Zgsjb8vg,iv:/bqTLCPqfGpsSJ8VjP+iLMFsY4v5MgS+algyk7i+UyM=,tag:FhWkGBPz2R91YtyMapS5wg==,type:str]
7+
TEST: ENC[AES256_GCM,data:YBP6L8Xs6obTi2UGjyU=,iv:QgDy8CVOa0hkdknMBTXo5J3eGX8fyI3QE1lbU9wNwjc=,tag:6SIHLus2mypK4wANigUAyQ==,type:str]
8+
sops:
9+
kms: []
10+
gcp_kms: []
11+
azure_kv:
12+
- vault_url: https://time-tracker-secrets.vault.azure.net
13+
name: tt-functions-sops
14+
version: 021de58b06a1497881bbacf4c82b83d7
15+
created_at: "2021-03-26T03:20:52Z"
16+
enc: osD5vc_2nP1Eun5hNzhoEH9vH2CwvpLzNwJKgj4EVx1pQqa7rfdrHr25btYAHIcflHJHOyoas28laZhEkNC6KucfwSRLSnVx0E0Aijnglf_eiQLdhzycbpjokmjF3DDWSnPXKGz2TJ0LVmeIAefeHardDj9RF2c5Qr5QC6y3XGd8HMaVKxelXzBUCM8qzVawfuefnPKQj7Q0s2PzxfsIWOX5JN3gT-5-yAjulanxTeqS-fh68gfkquMgEF8SATTGIwsWv3PJ3hA87_3mR0P_cHDUPpzzL0VMlwv2eGpeQXORw0UlsHGgsAoBKQR3C4CxzzLwAj-C8HO8RKehlbbyNQ
17+
hc_vault: []
18+
age: []
19+
lastmodified: "2021-03-26T03:20:56Z"
20+
mac: ENC[AES256_GCM,data:/ZZiCRFzc+15ooMFGRaTGMVnoQUsEDy1Fw8YznSmVWnL0k7fHQhdmkRKaunnBVfrhpgT/CnT5IE/sQoKJoPrjzifQX/UELKPIcCbOm/b9gfF+YVCkDWTUs5a2N3kcFGToqYjz9byPvPYzY8NugjHHcw1eLsF0omXWn6irOX0NUI=,iv:dzyI1XSYh1bzaTgxFgHdIh6egsnDm0RyS9pcxCJwhCc=,tag:rPtK0TrqdZy528LB6qxKCA==,type:str]
21+
pgp: []
22+
unencrypted_suffix: _unencrypted
23+
version: 3.7.0

nodejs-functions/package.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,6 @@
1111
"serverless"
1212
],
1313
"dependencies": {
14-
"@azure/cosmos": "3.5.2",
15-
"@azure/msal-node": "^1.0.0-alpha.5",
16-
"axios": "^0.20.0",
17-
"dotenv": "^8.2.0",
18-
"moment": "^2.27.0",
19-
"msal": "^1.4.0"
2014
},
2115
"devDependencies": {
2216
"serverless-azure-functions": "^2.1.0"

nodejs-functions/serverless.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
service: nodejs-functions
2+
frameworkVersion: "2"
3+
provider:
4+
name: azure
5+
region: West US 2
6+
runtime: nodejs12
7+
# linux is the only operating system available for python
8+
os: linux
9+
# prefix of generated resource name
10+
prefix: time-tracker
11+
environment:
12+
ENDPOINT: ${file(keys.yml):ENDPOINT}
13+
KEY: ${file(keys.yml):KEY}
14+
CLIENT_ID: ${file(keys.yml):CLIENT_ID}
15+
AUTHORITY: ${file(keys.yml):AUTHORITY}
16+
CLIENT_SECRET: ${file(keys.yml):CLIENT_SECRET}
17+
SLACK_TOKEN_NOTIFY: ${file(keys.yml):SLACK_TOKEN_NOTIFY}
18+
TEST: ${file(keys.yml):TEST}
19+
20+
custom:
21+
globalSchedule: cron(0 0 * * *)
22+
plugins:
23+
- serverless-azure-functions
24+
package:
25+
exclude:
26+
- local.settings.json
27+
- .vscode/**
28+
functions:
29+
automatic-clock-outs:
30+
prefix: automatic-clock-outs
31+
handler: src/handlers/automatic-clock-outs/index.js
32+
events:
33+
- timer: ${self:custom.globalSchedule}

0 commit comments

Comments
 (0)