diff --git a/README.md b/README.md index 8475c91..7a347ad 100644 --- a/README.md +++ b/README.md @@ -32,13 +32,9 @@ cargo install oxker ### Docker -Published on Docker Hub and ghcr.io, +Published on ghcr.io and Docker Hub, with images built for `linux/amd64`, `linux/arm64`, and `linux/arm/v6` -**via Docker Hub** -```shell -docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock:ro --pull=always mrjackwills/oxker -``` **via ghcr.io** @@ -46,6 +42,11 @@ docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock:ro --pull=alway docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock:ro --pull=always ghcr.io/mrjackwills/oxker ``` +**via Docker Hub** +```shell +docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock:ro --pull=always mrjackwills/oxker +``` + ### Nix Using nix flakes, oxker can be ran directly with @@ -126,7 +127,7 @@ Available command line arguments |```-t```| Remove timestamps from each log entry.| |```-s```| If running via Docker, will display the oxker container.| |```-g```| No TUI, essentially a debugging mode with limited functionality, for now.| -|```--config-file [string]```| Location of a `config.toml`/`config.json`/`config.jsonc`. By default will check the users local config figuration directory.| +|```--config-file [string]```| Location of a `config.toml`/`config.json`/`config.jsonc`. By default will check the users local config directory.| |```--host [string]```| Connect to Docker with a custom hostname. Defaults to `/var/run/docker.sock`. Will use `$DOCKER_HOST` environment variable if set.| |```--no-stderr```| Do not include stderr output in logs.| |```--save-dir [string]```| Save exported logs into a custom directory. Defaults to `$HOME`.| @@ -136,18 +137,19 @@ Available command line arguments ### Config File -A config file enables the user to persist settings, it also enables the user to create a custom keymap, and set the color scheme used by the application. +A config file enables the user to persist settings, create a custom keymap, set the color scheme used by the application, and more.

-By default, if not found, `oxker` will create a config file in the user's local config directory. Command line arguments take priority over values from the config file. +Examples of the config file, alsong with explanations of each value, can be found in the [example_config](https://github.com/mrjackwills/oxker/tree/main/example_config) directory. `oxker` supports `.toml`,`.json`, and `.jsonc` file formats.

-`oxker` supports `.toml`,`.json`, and `.jsonc` file formats. Examples of each can be found in the [example_config](https://github.com/mrjackwills/oxker/tree/main/example_config) directory. - -If running an `oxker` container, the default config location will be `/config.toml` rather than the automatically detected platform-specific local config directory. +If not config file is found, `oxker` will create a `config.toml` in the user's local config directory. Command line arguments will take priority over values from the config file. +
+
+If running an `oxker` container, the default config location will be `/` rather than the automatically detected platform-specific local config directory, and can be mounted as follows; ```shell -docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock:ro -v /some/location/config.toml:/config.toml:ro oxker +docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock:ro -v /some_location/config.toml:/config.toml:ro ghcr.io/mrjackwills/oxker ``` ## Build step diff --git a/example_config/example.config.json b/example_config/example.config.json deleted file mode 100644 index 68887fb..0000000 --- a/example_config/example.config.json +++ /dev/null @@ -1,190 +0,0 @@ -{ - "color_logs": false, - "docker_interval": 1000, - "gui": true, - "host": "/var/run/docker.sock", - "raw_logs": false, - "show_self": false, - "show_std_err": false, - "show_timestamp": true, - "timezone": "Etc/UTC", - "timestamp_format": "%Y-%m-%dT%H:%M:%S.%8f", - "use_cli": false, - "colors": { - "borders": { - "selected": "lightcyan", - "unselected": "grey" - }, - "chart_cpu": { - "background": "reset", - "border": "white", - "max": "#FFB224", - "points": "magenta", - "title": "green", - "y_axis": "white" - }, - "chart_memory": { - "background": "reset", - "border": "white", - "max": "#FFB224", - "points": "cyan", - "title": "green", - "y_axis": "white" - }, - "chart_ports": { - "background": "reset", - "border": "white", - "headings": "yellow", - "text": "white", - "title": "green" - }, - "commands": { - "background": "reset", - "delete": "gray", - "pause": "yellow", - "restart": "magenta", - "resume": "blue", - "start": "green", - "stop": "red" - }, - "container_state": { - "dead": "red", - "exited": "red", - "paused": "yellow", - "removing": "lightred", - "restarting": "lightgreen", - "running_healthy": "green", - "running_unhealthy": "#FFB224", - "unknown": "red" - }, - "containers": { - "background": "reset", - "icon": "white", - "text": "blue", - "text_rx": "#FFE9C1", - "text_tx": "#CD8C8C" - }, - "filter": { - "background": "reset", - "text": "gray", - "selected_filter_background": "gray", - "selected_filter_text": "black", - "highlight": "magenta" - }, - "headers_bar": { - "background": "magenta", - "loading_spinner": "white", - "text": "black", - "text_selected": "gray" - }, - "logs": { - "background": "reset", - "text": "reset" - }, - "popup_delete": { - "background": "white", - "text": "black", - "text_highlight": "red" - }, - "popup_error": { - "background": "red", - "text": "white" - }, - "popup_help": { - "background": "magenta", - "text": "black", - "text_highlight": "white" - }, - "popup_info": { - "background": "blue", - "text": "white" - } - }, - "keymap": { - "clear": [ - "c", - "esc" - ], - "delete_confirm": [ - "y" - ], - "delete_deny": [ - "n" - ], - "exec": [ - "e" - ], - "filter_mode": [ - "/", - "F1" - ], - "quit": [ - "q" - ], - "save_logs": [ - "s" - ], - "scroll_down_many": [ - "pagedown" - ], - "scroll_down_one": [ - "down", - "j" - ], - "scroll_end": [ - "end" - ], - "scroll_start": [ - "home" - ], - "scroll_up_many": [ - "pageup" - ], - "scroll_up_one": [ - "up", - "k" - ], - "select_next_panel": [ - "tab" - ], - "select_previous_panel": [ - "backtab" - ], - "sort_by_cpu": [ - "4" - ], - "sort_by_id": [ - "6" - ], - "sort_by_image": [ - "7" - ], - "sort_by_memory": [ - "5" - ], - "sort_by_name": [ - "1" - ], - "sort_by_rx": [ - "8" - ], - "sort_by_state": [ - "2" - ], - "sort_by_status": [ - "3" - ], - "sort_by_tx": [ - "9" - ], - "sort_reset": [ - "0" - ], - "toggle_help": [ - "h" - ], - "toggle_mouse_capture": [ - "m" - ] - } -} \ No newline at end of file diff --git a/src/config/parse_config_file.rs b/src/config/parse_config_file.rs index a444a07..2af4a46 100644 --- a/src/config/parse_config_file.rs +++ b/src/config/parse_config_file.rs @@ -224,15 +224,6 @@ mod tests { assert_eq!(Keymap::from(result.keymap), Keymap::new()); } - #[test] - /// make sure example.config.json matches the default keymap - fn test_parse_config_keymap_json() { - let example_json = include_str!("../../example_config/example.config.json"); - let result = ConfigFile::parse(super::ConfigFileType::Json, example_json).unwrap(); - assert!(result.keymap.is_some()); - assert_eq!(Keymap::from(result.keymap), Keymap::new()); - } - #[test] /// All configs parsed and are equal fn test_parse_config_keymap_all() { @@ -241,11 +232,6 @@ mod tests { assert!(result_jsonc.keymap.is_some()); let result_jsonc = result_jsonc.keymap.unwrap(); - let example_json = include_str!("../../example_config/example.config.json"); - let result_json = ConfigFile::parse(super::ConfigFileType::Json, example_json).unwrap(); - assert!(result_json.keymap.is_some()); - let result_json = result_json.keymap.unwrap(); - let example_toml = include_str!("./config.toml"); let result_toml = ConfigFile::parse(super::ConfigFileType::Toml, example_toml).unwrap(); assert!(result_toml.keymap.is_some()); @@ -253,7 +239,6 @@ mod tests { assert_eq!(Keymap::from(Some(result_toml.clone())), Keymap::new()); assert_eq!(result_toml, result_jsonc); - assert_eq!(result_jsonc, result_json); } #[test] @@ -274,15 +259,6 @@ mod tests { assert_eq!(AppColors::from(result.colors), AppColors::new()); } - #[test] - /// make sure config.toml matches the default app colors - fn test_parse_config_colors_json() { - let example_json = include_str!("../../example_config/example.config.json"); - let result = ConfigFile::parse(super::ConfigFileType::Json, example_json).unwrap(); - assert!(result.colors.is_some()); - assert_eq!(AppColors::from(result.colors), AppColors::new()); - } - #[test] /// All configs parsed and are equal fn test_parse_config_colors_all() { @@ -291,11 +267,6 @@ mod tests { assert!(result_jsonc.colors.is_some()); let result_jsonc = result_jsonc.colors.unwrap(); - let example_json = include_str!("../../example_config/example.config.json"); - let result_json = ConfigFile::parse(super::ConfigFileType::Json, example_json).unwrap(); - assert!(result_json.colors.is_some()); - let result_json = result_json.colors.unwrap(); - let example_toml = include_str!("./config.toml"); let result_toml = ConfigFile::parse(super::ConfigFileType::Toml, example_toml).unwrap(); assert!(result_toml.colors.is_some()); @@ -303,6 +274,5 @@ mod tests { assert_eq!(AppColors::from(Some(result_toml.clone())), AppColors::new()); assert_eq!(result_toml, result_jsonc); - assert_eq!(result_jsonc, result_json); } }