im
Clone
https://git.tahinli.com/Tahinli/im.git
0 watching0 forksRustAGPL-3.0542.8 KiBb9f0726Tahinli27 days ago34 commits
| 1 | //! The `im` binary: the command line, logging and the process lifetime. |
| 2 | //! |
| 3 | //! `im [--config <path>] [serve]` runs the server; a bare `im` does the same. `im client ...` manages the |
| 4 | //! OpenID Connect clients (`cli.rs`). `im admin ...` is the operator command line, which is not built yet. The configuration file is the `--config` path, |
| 5 | //! then `IM_CONFIG`, then `config/im.toml`. Exit status 0 is success, 1 a failure, 2 a usage error. |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | use ; |
| 30 | use ExitCode; |
| 31 | |
| 32 | use EnvFilter; |
| 33 | |
| 34 | /// Printed with a usage error. |
| 35 | const USAGE: &str = "usage: im [--config <path>] [serve | client <add|list|disable> ... | backup now | restore --from <set> | fsck | keys rotate]"; |
| 36 | |
| 37 | /// The configuration file when neither `--config` nor `IM_CONFIG` names one. |
| 38 | const DEFAULT_CONFIG: &str = "config/im.toml"; |
| 39 | |
| 40 | /// The environment variable that names the configuration file. |
| 41 | const CONFIG_ENV: &str = "IM_CONFIG"; |
| 42 | |
| 43 | /// The parsed command line: the `--config` path and the positional words. |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | /// Splits the arguments into the `--config <path>` pair and the positional words. |
| 50 | |
| 51 | |
| 52 | |
| 53 | |
| 54 | |
| 55 | |
| 56 | |
| 57 | |
| 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 | |
| 63 | |
| 64 | |
| 65 | /// The configuration path: the flag, else `IM_CONFIG`, else the default. |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 70 | |
| 71 | /// Logs to stderr. The level comes from `RUST_LOG`, and defaults to `info`. |
| 72 | |
| 73 | |
| 74 | |
| 75 | |
| 76 | |
| 77 | |
| 78 | |
| 79 | |
| 80 | /// Runs the server and maps its outcome to an exit status. |
| 81 | async |
| 82 | |
| 83 | |
| 84 | |
| 85 | |
| 86 | |
| 87 | |
| 88 | |
| 89 | |
| 90 | |
| 91 | |
| 92 | async |
| 93 | |
| 94 | |
| 95 | |
| 96 | |
| 97 | |
| 98 | |
| 99 | |
| 100 | |
| 101 | |
| 102 | |
| 103 | |
| 104 | |
| 105 | |
| 106 | |
| 107 | |
| 108 | |
| 109 | |
| 110 | |
| 111 | |
| 112 | |
| 113 | |
| 114 |