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
FROM osgeo/gdal | |
ENV PORT=8888 | |
RUN apt-get update | |
RUN apt-get install -y \ | |
python3-pip | |
RUN python -m pip install \ | |
gdal \ |
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
from pprint import pprint | |
from google.protobuf.pyext.cpp_message import GeneratedProtocolMessageType | |
from google.protobuf.descriptor import FieldDescriptor | |
from myproto import schema_pb2 | |
pb_types = { | |
FieldDescriptor.TYPE_BOOL: bool, | |
FieldDescriptor.TYPE_BYTES: bytes, |
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
""" | |
Proto | |
enum EntityType { | |
GEOMETRY = 0; | |
PHYSICAL = 1; | |
} | |
extend google.protobuf.MessageOptions { | |
EntityType entity_type = 100; |
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
# netlify.toml | |
[build] | |
functions = "build-lambda" | |
publish = "dist/" | |
command = "yarn build" |
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
// vue.config.js | |
module.exports = { | |
devServer: { | |
proxy: { | |
'^/.netlify': { | |
target: 'http://localhost:9000', | |
pathRewrite: { '^/.netlify/functions': '' } | |
} | |
} | |
} |
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
// lambdaService.js | |
import axios from 'axios' | |
const $axios = axios.create({ | |
baseURL: '/.netlify/functions', | |
timeout: 10000 // 10 seconds | |
}) | |
// Response Interceptor to handle and log errors | |
$axios.interceptors.response.use( |
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
{ | |
"scripts": { | |
"serve": "vue-cli-service serve", | |
"serve:lambda": "netlify-lambda serve lambda", | |
"build": "run-p build:**", | |
"build:app": "vue-cli-service build", | |
"build:lambda": "netlify-lambda build lambda", | |
"...": "..." | |
}, |
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
// lambda/airtable.js | |
const Airtable = require('airtable') | |
Airtable.configure({ | |
endpointUrl: 'https://api.airtable.com', | |
apiKey: process.env.AIRTABLE_KEY | |
}) | |
const base = Airtable.base('appNtnZ99fkL1cByn') | |
exports.handler = function(event, context, callback) { |
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
# Asserts given env vars are set | |
# Usage: assert_envs { args } | |
# eg. DBHOST DBPORT DBNAME DBUSER | |
assert_envs() { | |
for var in "$@"; do | |
if [ -z "${!var}" ]; then | |
error "$var environment is required and is not set" | |
exit 1 | |
fi | |
done |
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
info " Checking DB Connection" | |
while ! python3 manage.py inspectdb >/dev/null 2>&1; do | |
warn " DB is not ready" | |
sleep 5 | |
done | |
info " DB is ready" |
NewerOlder