Compare commits
6 Commits
c77485c4a1
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
741ac73e35 | ||
|
|
bb5390928e | ||
|
|
e9be4808ed | ||
|
|
3b6312b596 | ||
|
|
f31221caf0 | ||
|
|
f1b0ace7ae |
@@ -17,16 +17,17 @@ spec:
|
||||
containers:
|
||||
- name: api-container
|
||||
image: 4grxfq/api
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 5001
|
||||
name: api-port
|
||||
env:
|
||||
- name: OPENID_SECRET
|
||||
value: CHANGEME
|
||||
value:
|
||||
- name: DNS_SERVER
|
||||
value: "IP"
|
||||
value: dnsns.mashallah.nl
|
||||
- name: MONGO_CONNECTIONSTRING
|
||||
value: CHANGEME
|
||||
value:
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
@@ -36,7 +37,27 @@ metadata:
|
||||
run: api-service
|
||||
spec:
|
||||
ports:
|
||||
- port: 5001
|
||||
- port: 80
|
||||
targetPort: 5001
|
||||
protocol: TCP
|
||||
selector:
|
||||
app: api-deployment
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: api-ingress
|
||||
annotations:
|
||||
kubernetes.io/ingress.class: addon-http-application-routing
|
||||
spec:
|
||||
rules:
|
||||
- host: dnsapi.mashallah.nl
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: api-service
|
||||
port:
|
||||
number: 80
|
||||
@@ -17,16 +17,17 @@ spec:
|
||||
containers:
|
||||
- name: gui-container
|
||||
image: 4grxfq/gui
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 5000
|
||||
name: gui-port
|
||||
env:
|
||||
- name: OPENID_SECRET
|
||||
value: CHANGEME
|
||||
value:
|
||||
- name: DNS_API
|
||||
value: "http://api:5001"
|
||||
value: http://api-service:80
|
||||
- name: MONGO_CONNECTIONSTRING
|
||||
value: CHANGEME
|
||||
value:
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
@@ -36,7 +37,27 @@ metadata:
|
||||
run: gui-service
|
||||
spec:
|
||||
ports:
|
||||
- port: 5000
|
||||
- port: 80
|
||||
targetPort: 5000
|
||||
protocol: TCP
|
||||
selector:
|
||||
app: gui-deployment
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: gui-ingress
|
||||
annotations:
|
||||
kubernetes.io/ingress.class: addon-http-application-routing
|
||||
spec:
|
||||
rules:
|
||||
- host: dnsgui.mashallah.nl
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: gui-service
|
||||
port:
|
||||
number: 80
|
||||
File diff suppressed because one or more lines are too long
@@ -6,5 +6,6 @@ RUN pip install --no-cache-dir -r /app/requirements.txt
|
||||
COPY openid.py /app/
|
||||
COPY dnszone.py /app/
|
||||
COPY openid.py /app/
|
||||
COPY mango.py /app
|
||||
COPY api.py /app/
|
||||
CMD ["python3", "/app/api.py"]
|
||||
@@ -14,7 +14,7 @@ class GoogleOID:
|
||||
|
||||
self.settings = {'client_id': '954325872153-1v466clrtgg6h4ptt2ne5pgpb9mhilr5.apps.googleusercontent.com',
|
||||
'client_secret': client_secret,
|
||||
'callback_uri': 'http://dnsdash.mashallah.nl:5000/login/gcp/callback',
|
||||
'callback_uri': 'https://dnsgui.mashallah.nl/login/gcp/callback',
|
||||
'key_server': 'https://www.googleapis.com/oauth2/v3/certs'} # global oid settings
|
||||
|
||||
def settings(self): # make it so that the settings variable is callable
|
||||
|
||||
@@ -14,7 +14,7 @@ class GoogleOID:
|
||||
|
||||
self.settings = {'client_id': '954325872153-1v466clrtgg6h4ptt2ne5pgpb9mhilr5.apps.googleusercontent.com',
|
||||
'client_secret': client_secret,
|
||||
'callback_uri': 'http://dnsdash.mashallah.nl:5000/login/gcp/callback',
|
||||
'callback_uri': 'https://dnsgui.mashallah.nl/login/gcp/callback',
|
||||
'key_server': 'https://www.googleapis.com/oauth2/v3/certs'} # global oid settings
|
||||
|
||||
def settings(self): # make it so that the settings variable is callable
|
||||
|
||||
40
eindopdracht/lambda/lambda_function.py
Normal file
40
eindopdracht/lambda/lambda_function.py
Normal file
@@ -0,0 +1,40 @@
|
||||
import json
|
||||
import boto3
|
||||
import base64
|
||||
|
||||
|
||||
def lambda_handler(event, context):
|
||||
method = str(event.get('requestContext').get('http').get('method'))
|
||||
|
||||
dynamodb = boto3.resource('dynamodb')
|
||||
table = dynamodb.Table('lambdatable')
|
||||
|
||||
if method == "POST":
|
||||
key = str(event.get('pathParameters').get('id'))
|
||||
url = str(base64.b64decode(event.get('body')), 'utf-8')
|
||||
|
||||
table.put_item(Item={'key': key, 'url': url})
|
||||
|
||||
return {'message': url}
|
||||
elif method == "DELETE":
|
||||
key = str(event.get('pathParameters').get('id'))
|
||||
|
||||
table.delete_item(Key={'key': key})
|
||||
return {'message': key}
|
||||
|
||||
else:
|
||||
key = str(event.get('pathParameters').get('id'))
|
||||
|
||||
data = table.get_item(Key={"key": key})
|
||||
|
||||
if len(data) is 1:
|
||||
return {'message': 'No such key'}
|
||||
|
||||
response = {
|
||||
"statusCode": 302,
|
||||
"headers": {
|
||||
'Location': data['Item']['url']
|
||||
}
|
||||
}
|
||||
|
||||
return response
|
||||
Reference in New Issue
Block a user