github.com/iron-io/functions@v0.0.0-20180820112432-d59d7d1c40b2/examples/checker/README.md (about)

     1  # Environment Checker Function Image
     2  
     3  This images compares the payload info with the header.
     4  
     5  ```
     6  # Create your func.yaml file
     7  fn init <YOUR_DOCKERHUB_USERNAME>/func-checker
     8  # Build the function
     9  fn build
    10  # Test it
    11  echo '{"env_vars": {"HEADER_FOO": "bar"}}' | ./fn run -e FOO=bar
    12  # Push it to Docker Hub
    13  fn push
    14  # Create routes to this function on IronFunctions
    15  fn apps create <YOUR_APP>
    16  fn routes create <YOUR_APP> /check --config TEST=1
    17  ```
    18  
    19  ## Running it on IronFunctions
    20  
    21  ### Let's define some environment variables
    22  
    23  ```
    24  # Set your Function server address
    25  # Eg. 
    26  # FUNCAPI=127.0.0.1:8080
    27  # APPNAME=checker
    28  FUNCAPI=YOUR_FUNCTIONS_ADDRESS
    29  APPNAME=YOUR_APP
    30  ```
    31  
    32  ### Testing function
    33  
    34  Now that we created our IronFunction route, let's test our new route
    35  
    36  ```
    37  curl -X POST --data '{ "env_vars": { "TEST": "1" } }' http://$FUNCAPI/r/$APPNAME/check
    38  ```
    39