Skip to content

Instantly share code, notes, and snippets.

View MeiyappanKannappa's full-sized avatar

Karthik Meiyappan MeiyappanKannappa

View GitHub Profile
LDConfig config = new LDConfig.Builder()
.logging(Components.logging(Logs.basic()))
.build();
LDClient client = new LDClient(SDK_KEY, config);
repositories {
mavenCentral()
maven { url "https://oss.sonatype.org/content/groups/public/" }
}
dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
// https://mvnrepository.com/artifact/com.launchdarkly/launchdarkly-java-server-sdk
implementation 'com.launchdarkly:launchdarkly-java-server-sdk:5.10.0'
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
// This widget is the root of your application.
plugins {
id 'org.springframework.boot' version '2.7.2'
id 'io.spring.dependency-management' version '1.0.12.RELEASE'
id 'java'
}
group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'
def grpcVersion = "1.39.0"
package com.example.shedlockdemo;
import com.authzed.api.v1.Core;
import com.authzed.api.v1.PermissionService;
import com.authzed.api.v1.PermissionsServiceGrpc;
import com.authzed.grpcutil.BearerToken;
import io.grpc.ManagedChannel;
import io.grpc.ManagedChannelBuilder;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
syntax = "proto3";
option java_multiple_files = true;
option java_package = "io.grpc.examples.helloworld";
option java_outer_classname = "HelloWorldProto";
option objc_class_prefix = "HLW";
package helloworld;
// The greeting service definition.
@MeiyappanKannappa
MeiyappanKannappa / greeter_client.js
Created March 27, 2022 09:44
Grpc Client code to connect to HTTP1.1 server via Envoy proxy
var PROTO_PATH = __dirname + '/../../protos/helloworld.proto';
var parseArgs = require('minimist');
var grpc = require('@grpc/grpc-js');
var protoLoader = require('@grpc/proto-loader');
var packageDefinition = protoLoader.loadSync(
PROTO_PATH,
{keepCase: true,
longs: String,
enums: String,
@MeiyappanKannappa
MeiyappanKannappa / app.js
Created March 27, 2022 09:43
Node-Express Server side API for envoy grpc reverse bridge
const bodyParser= require('body-parser')
const express = require('express')
const app = express()
const port = 80
var PROTO_PATH = __dirname + '/../../protos/helloworld.proto';
const protobuf = require('protobufjs');
app.use(bodyParser.json({
verify: (req, res, buf) => {
@MeiyappanKannappa
MeiyappanKannappa / reverse-proxy.yaml
Created March 27, 2022 09:10
Envoy-GRPC-Reverse Proxy Bridge
admin:
address:
socket_address:
address: 0.0.0.0
port_value: 9901
static_resources:
listeners:
- name: listener_0
address:
socket_address:
app.get('/getBalance', (req, res) => { // new
var myContract = new web3.eth.Contract(contracts.abi, process.env.CONTRACTS_ADDRESS, {
from: req.query.account_id, // default from address
gasPrice: '3000000' // default gas price in wei, 20 gwei in this case
});
myContract.methods.balance().call({from: req.query.account_id,gasPrice: '3000000'})
.then(function(result){
console.log(result+' wei')
res.header('Access-Control-Allow-Origin', "*");
res.header('Access-Control-Allow-Headers', "*");