Coder Social home page Coder Social logo

grpc-lightwalletd-poc's Introduction

gRPC POC - A gRPC Proof of concept

Motivation

test Swift-GRPC services using lightwalletd nodes

installing

Install Sourcery and put it in your PATH variable or brew install sourcery

Clone and run pod install

setting it up

We don't like to commit address so the environment has to be set up from environment variables. This project users Sourcery to generate a Swift file with the secret environment variables from a template and a value you provide before compiling your sources.

Constants generated sources

public struct Constants {
    static let address: String = "{{ argument.addr }}"
}

Setting your 'LIGHTWALLETD_ADDRESS' environment variable (sh file option)

on your Source directory, create the file: env-vars.sh

export LIGHTWALLETD_ADDRESS=YOUR_BASH_ESCAPED_ADDRESS

Setting your 'LIGHTWALLETD_ADDRESS' environment variable

Make sure that there's a value for the variable LIGHTWALLETD_ADDRESS when the build is triggered.

This will make the Script on the "run script" phase get the correct environment variable for you. If running on CI, you can set the ENVIRONMENT_VARIABLE directly. (you can do that on your dev environment as well) If you take a look at the environment class, you will see that it will expect to get it from the LIGHTWALLETD-ADDRESS key.

important: in order for code generation to work, it's important to enforce the Legacy Build System to be used :(

class Environment {
    static let lightwalletdKey = "LIGHTWALLETD_ADDRESS"
    
    static var address: String {
        return Constants.address
    }
}

Testing

You can verify that the environment is being set up properly by running the tests

 func testEnvironmentLaunch() {
        
        let address = gRPC_PoC.Environment.address
        
        XCTAssertFalse(address.isEmpty, "Your \'\(Environment.lightwalletdKey)\' key is missing from your launch environment variables")
    }
    

Running it

If you did everything correctly and your tests pass you should see this

Otherwise you will see this when running

Contributing

If you find any issues please create one.

License

Apache License Version 2.0

grpc-lightwalletd-poc's People

Contributors

pacu avatar

Watchers

 avatar James Cloos avatar Kevin Gorham avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.