From 6e439233ec42a01fb7e735fc4276fa1a25d40734 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Sat, 20 Feb 2021 22:34:59 -0800 Subject: [PATCH] Created Use Config File for Command Line Options (markdown) --- Use-Config-File-for-Command-Line-Options.md | 29 +++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 Use-Config-File-for-Command-Line-Options.md diff --git a/Use-Config-File-for-Command-Line-Options.md b/Use-Config-File-for-Command-Line-Options.md new file mode 100644 index 0000000..24044ba --- /dev/null +++ b/Use-Config-File-for-Command-Line-Options.md @@ -0,0 +1,29 @@ +Direct command line can get too long: + +``` +weed -logdir=../mlog master -mdir=../mdir -peers=192.168.126.5:3333,192.168.126.16:3333,192.168.126.18:3333 -port=3333 -defaultReplication=001 +``` + +You can put these command line options into a configuration file : + +``` +# master.conf +logdir=../mlog +mdir=../mdir +peers=192.168.126.5:3333,192.168.126.16:3333,192.168.126.18:3333 +port=3333 +defaultReplication=001 +``` + +then refer it as +``` +weed master -config=master.conf +``` + +Order of precedence of this flag, it is borrowed from https://github.com/namsral/flag with some customized for weed: +``` +1. Command line options +2. Environment variables +3. Configuration file +4. Default values +``` \ No newline at end of file