github.com/TrueBlocks/trueblocks-core/src/apps/chifra@v0.0.0-20241022031540-b362680128f7/internal/daemon/README.md (about) 1 ## chifra daemon 2 3 `chifra daemon` manages chifra's API server. Each of the `chifra` commands along with all of its options, 4 are provided not only by the command line, but also the API server. We call this process the 5 `flame` server, which is written in Go. `chifra serve` is an alias for the `chifra daemon` command. 6 7 In the future, this daemon may also manage other long-running processes such as `chifra scrape` 8 and `chifra monitors`, but for now, it's only managing the API server. 9 10 If the default port for the API server is in use, you may change it with the `--url` option. 11 12 To get help for any command, please see the API documentation on our website. But, you may 13 also run `chifra --help` or `chifra <cmd> --help` on your command line to get help. 14 15 See below for an example of converting command line options to a call to the API. There's a 16 one-to-one correspondence between the command line tools and options and the API routes and 17 their options. 18 19 ```[plaintext] 20 Purpose: 21 Initialize and control long-running processes such as the API and the scrapers. 22 23 Usage: 24 chifra daemon [flags] 25 26 Aliases: 27 daemon, serve 28 29 Flags: 30 -u, --url string specify the API server's url and optionally its port (default "localhost:8080") 31 --silent disable logging (for use in SDK for example) 32 -v, --verbose enable verbose output 33 -h, --help display this help screen 34 35 Notes: 36 - To start API open terminal window and run chifra daemon. 37 - See the API documentation (https://trueblocks.io/api) for more information. 38 - The --port option is deprecated, use --url instead. 39 - The --grpc option is deprecated, there is no replacement. 40 - The --api option is deprecated, there is no replacement. 41 - The --scrape option is deprecated, use chifra scrape instead. 42 - The --monitor option is deprecated, use chifra monitors --watch instead. 43 ``` 44 45 Data models produced by this tool: 46 47 - none 48 49 ### further information 50 51 To convert the options for a command line tool to an API call, do the following: 52 53 1. Any `--snake_case` argument to the command line should be converted to `camelCase`. For example, `--no_header` on the command line should be sent as `&noHeader` to the API server. 54 2. Any `switch` on the command line, (i.e., options whose presence indicates `true` and whose absence indicates `false`) should be sent as a `boolean` to the API server. For example, `--no_header` on the command line should be sent as `&noHeader=true` to the API server. If the option is `fales`, you do not need to send it to the API server. 55 3. Positionals such as the addresses, topics, and four-bytes for `chifra export`, must be prepended with their positional name. For example, `chifra export <address> <topic>` should be sent as `&addrs=<address>&topics=<topic>` to the API server. For some commands (experiment) you may send more than one value for a positional with `%20` separating the entries or by sending multiple positionals (i.e., `&addrs=<address1>&addrs=<address2>`). 56 57 <hr /> 58 <span style="size: -2; background-color: #febfc1; color: black; display: block; padding: 4px"> 59 Chifra was built for the command line, a fact we purposefully take advantage of to ensure continued operation on small machines. As such, this tool is not intended to serve multiple end users in a cloud-based server environment. This is by design. Be forewarned. 60 </span> 61 <hr /> 62 63 ### Other Options 64 65 All tools accept the following additional flags, although in some cases, they have no meaning. 66 67 ```[plaintext] 68 -v, --version display the current version of the tool 69 --output string write the results to file 'fn' and return the filename 70 --append for --output command only append to instead of replace contents of file 71 --file string specify multiple sets of command line options in a file 72 ``` 73 74 **Note:** For the `--file string` option, you may place a series of valid command lines in a file using any 75 valid flags. In some cases, this may significantly improve performance. A semi-colon at the start 76 of any line makes it a comment. 77 78 **Note:** If you use `--output --append` option and at the same time the `--file` option, you may not switch 79 export formats in the command file. For example, a command file with two different commands, one with `--fmt csv` 80 and the other with `--fmt json` will produce both invalid CSV and invalid JSON. 81 82 *Copyright (c) 2024, TrueBlocks, LLC. All rights reserved. Generated with goMaker.*