diff --git a/README.md b/README.md index a0913f0..d39e946 100644 --- a/README.md +++ b/README.md @@ -13,8 +13,7 @@ Setting up this integration requires: ### tl;dr if you know what you're doing * `git clone && cd antell-lunchmenu-flowdock && npm i` * Create flowdock app, get (source) token for your flow -* Set up env vars (.env file), see section in this readme -* run `npm run lunchmenu` every morning +* run `npm run lunchmenu -- ` every morning, see args in *Command line arguments* ### Hosting on Heroku for free The easiest way to host the integration is to [create a free Heroku dyno](https://signup.heroku.com/) with all dynos scaled to zero. @@ -29,27 +28,33 @@ This integration only runs during scheduled intervals for a few seconds, meaning 2. Go to your newly created app and **Create a new source** for the flow which you want menus to be sent. It will give you a 32-character *token* - store this and keep it safe. This token lets the script post messages to your flow. 3. Sign up for a Heroku account and create a new personal app - https://signup.heroku.com/ 1. In the **Deploy** tab, choose Github as the *Deployment method*, then choose the repository you just forked - 2. Go to the **Settings** tab, reveal the config vars in *Config Variables*, and set up the configuration according to the *Environmental variables* section of this README - 3. In the **Deploy** tab, deploy the project in the *Manual deployment* section - 4. In the **Resources tab**, disable the `web` dyno. This is created by Heroku by default but we don't use it. + 2. Deploy the project in the *Manual deployment* section + 3. In the **Resources tab**, disable the `web` dyno. This is created by Heroku by default but we don't use it. 4. Set up the Heroku scheduler - - Go to the **Resources** tab and enable the "Heroku Scheduler" add-on. Schedule the following command: `npm run lunchmenu` + - Go to the **Resources** tab and enable the "Heroku Scheduler" add-on. Schedule the following command: `npm run lunchmenu -- ` where are the arguments as seen below in *Command line arguments* 5. Done! -## Environmental variables -This script makes use of environmental variables to configure the flowdock source flow tokens and the Antell website URL. +## Command line arguments +This script makes use of command line arguments to configure the behavior. -| Variable name | Value | -|---------------|-------| -| `ANTELL_MENU_URL` | The address of the lunch menu, e.g. http://www.antell.fi/lounaslistat/lounaslista.html?owner=112 | -| `FLOWDOCK_FLOW_TOKENS` | Comma separated array of the tokens of the flows to which you want lunch menus sent | +``` +Options: + -u, --url url of the lunch list [string] [required] + -f, --flow flow source token of the target flow [string] [required] + -t, --tags tags of the message sent [array] + --help Show help [boolean] +``` -### Example `.env` +Example: -```sh -ANTELL_MENU_URL=http://www.antell.fi/lounaslistat/lounaslista.html?owner=112 -FLOWDOCK_FLOW_TOKENS=dd03287fa5154e309bf72f57390d5d2a,f4888feac07b44398f5f4a06b85a6477 ``` +npm run lunchmenu -- \ +-f 1234567895154e309bf72f5123456789 \ +-u http://www.antell.fi/lounaslistat/lounaslista.html?owner=112 \ +-t #lunch_menu #antell +``` + +Note: when running via `npm run`, the `--` after the script name (lunchmenu) is required so that `npm` realizes that you're not trying to pass the args to *it*. ## License antell-lunchmenu-flowdock is licensed under the MIT license. See LICENSE.