Guest User

Untitled

a guest
Dec 18th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. # A simple action to prove it works
  2. $ cat myaction.php
  3. <?php
  4. function main(array $args) : array
  5. {
  6. return $args;
  7. }
  8. $ bx wsk action update myaction myaction.php
  9.  
  10. # Create the PostgreSQL database
  11. $ bx service create elephantsql turtle mydatabase
  12.  
  13. # Create some credentials for the database
  14. $ bx service key-create mydatabase openwhisk-creds
  15.  
  16. # Bind the credentials to the "myaction" action
  17. $ bx wsk service bind elephantsql myaction --instance mydatabase --keyname openwhisk-creds
  18.  
  19. # Run the action to prove it works
  20. $ bx wsk action invoke myaction -r
  21. {
  22. "__bx_creds": {
  23. "elephantsql": {
  24. "credentials": "openwhisk-creds",
  25. "instance": "mydatabase",
  26. "max_conns": "5",
  27. "uri": "postgres://******:******@packy-01.db.elephantsql.com:5432/uhbbioqq"
  28. }
  29. }
  30. }
Add Comment
Please, Sign In to add comment