git clone git@github.com:grpc/grpc-web.git
you might need sudo apt-get install libprotoc-dev
sudo make install-plugin - (this installs the protoc-gen-grpc-web)
| import * as functions from 'firebase-functions'; | |
| import * as http from 'http'; | |
| const BUCKET_NAME = "target-bucket" | |
| // check original code idea https://stackoverflow.com/a/10435819 | |
| exports.rewriteGCSRequest = functions.https.onRequest((oreq: any, ores: any) => { | |
| const redirectPath = oreq.originalUrl === '/' ? '/index.html' : oreq.originalUrl | |
| const options = { | |
| // host to forward to |
| { | |
| "__inputs": [ | |
| { | |
| "name": "DS_PROMETHEUS", | |
| "label": "Prometheus", | |
| "description": "", | |
| "type": "datasource", | |
| "pluginId": "prometheus", | |
| "pluginName": "Prometheus" | |
| } |
| import akka.actor.ActorSystem | |
| import akka.stream.ActorAttributes | |
| import akka.stream.Supervision.Stop | |
| import akka.stream.scaladsl.{ Flow, RestartFlow, Sink, Source } | |
| import scala.concurrent.Await | |
| import scala.concurrent.duration._ | |
| import scala.util.control.NonFatal | |
| import scala.concurrent.Future |
git clone git@github.com:grpc/grpc-web.git
you might need sudo apt-get install libprotoc-dev
sudo make install-plugin - (this installs the protoc-gen-grpc-web)
| implicit class EitherSourceExtension[L, R, Mat](source: Source[Either[L, R], Mat]) { | |
| def partition[LMat, RMat, NewMat](left: Sink[L, LMat], right: Sink[R, RMat])( | |
| combineMat: (Mat, LMat, RMat) => NewMat | |
| ): Graph[ClosedShape.type, NewMat] = { | |
| GraphDSL.create(source, left, right)(combineMat)( | |
| implicit builder => | |
| (source, left, right) => { | |
| import GraphDSL.Implicits._ |
| implicit class EitherSourceExtension[L, R, Mat](source: Source[Either[L, R], Mat]) { | |
| def partition(left: Sink[L, NotUsed], right: Sink[R, NotUsed]): Graph[ClosedShape, NotUsed] = { | |
| GraphDSL.create() { implicit builder => | |
| import akka.stream.scaladsl.GraphDSL.Implicits._ | |
| val partition = builder.add(Partition[Either[L, R]](2, element => if (element.isLeft) 0 else 1)) | |
| source ~> partition.in | |
| partition.out(0).collect { | |
| case Left(value) => value | |
| } ~> left |
| console.log('Preparing deployment function.') | |
| var AWS = require('aws-sdk'); | |
| var lambda = new AWS.Lambda(); | |
| var lambdasToDeploy = JSON.parse(new Buffer(process.env.CONFIGURATION, 'base64').toString("ascii")); | |
| exports.handler = function(event, context) { | |
| console.log('Running deployment function for ' + JSON.stringify(lambdasToDeploy)); | |
| key = event.Records[0].s3.object.key | |
| bucket = event.Records[0].s3.bucket.name | |
| version = event.Records[0].s3.object.versionId |