All configuration to Presence is provided as key-value pairs, through environment variables, a .env
formatted file, or in a JSON-formatted command-line parameter.
For information about each network’s limitations, see: Network specific constraints
Presence supports multiple accounts.
Assign a unique prefix to each account to help you distinguish between them, and provide a comma-separated list of account prefixes in the PRESENCE_ACCOUNTS
variable.
eg. In this example, there are 2 accounts, with prefixes TEST0
and TEST1
:
PRESENCE_ACCOUNTS="TEST0,TEST1"
You will likely assign much more meaningful names to your accounts.
Each configuration key is constructed as follows:
<AccountPrefix>_<Network>_<CredentialType>
For example:
TEST1
AT
(ie. BlueSky)AccountName
_
underscore characterThese combine to give a key of: TEST1_AT_AccountName
Each network requires specific configuration keys, which relate to the configuration required to connect to and post to the network.
See:
Presence.Posting.Console
accepts configuration variables through the environment or from a .env
format configuration file.
Filename: .env.example
PRESENCE_ACCOUNTS="TEST0,TEST1"
TEST0_Console_PrintPrefix="Console>"
TEST1_AT_AccountName="presence-lib-test.bsky.social"
TEST1_AT_AppPassword="<the app password goes here>"
Presence.SocialFormat.Console -f SampleData/SimpleThread.md -n AT,Console | Presence.Posting.Console
-e
/ --env-file
parameterPresence.SocialFormat.Console -f SampleData/SimpleThread.md -n AT,Console | Presence.Posting.Console -e .env.example
Alternatively, you may provide the configuration as a json object that’s effectively an IDictionary<string,string>
You may provide this to Presence.Posting.Console
either:
PRESENCE_CONFIG_JSON
variable (see: ConfigKeys
), or-j
/ --json-config
parameterThis key supercedes any others found in the configuration.
PRESENCE_CONFIG_JSON
as an environment variableSample JSON:
{ "PRESENCE_ACCOUNTS": "TEST0", "TEST0_Console_PrintPrefix": "JsonConfiguredConsole" }
provide configuration JSON in the PRESENCE_CONFIG_JSON
variable, and invoke with:
Presence.SocialFormat.Console -f SampleData/SimpleThread.md -n Console | Presence.Posting.Console
PRESENCE_CONFIG_JSON
variable in a .env
fileFilename: .env.example
PRESENCE_JSON_CONFIG="{ \"PRESENCE_ACCOUNTS\": \"TEST0\", \"TEST0_Console_PrintPrefix\": \"JsonConfiguredConsole\" }"
Invoke with:
Presence.SocialFormat.Console -f SampleData/SimpleThread.md -n Console | Presence.Posting.Console -e .env.example
In this case, only the PRESENCE_CONFIG_JSON
key will be used from: .env.example
JsonConfiguredConsole
TEST0_Console_PrintPrefix
is ignored.env
file would also be ignored-j
/ --json-config
parameterInvoke with:
Presence.SocialFormat.Console -f SampleData/SimpleThread.md -n Console | Presence.Posting.Console -j "{ \"PRESENCE_ACCOUNTS\": \"TEST0\", \"TEST0_Console_PrintPrefix\": \"JsonConfiguredConsole\" }"
In the example above, all environment variables are ignored, and configuration comes only from the -j
/ --json-config
parameter.