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.
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
These combined to give a key of: TEST1_AT_AccountName
Each network requires specific configuration keys.
Console
networkThe Console network is used to test threads by printing to your console instead of posting to a social network.
The Network is always: Console
Credential type | Req | Value |
---|---|---|
PrintPrefix |
Required | A short piece of text to print at the beginning of each line. |
eg. The following line defines the PrintPrefix
key and value in a .env
configuration file:
TEST0_Console_PrintPrefix="Console>"
AT
(BlueSky) networkCreate an application password for your account in Privacy & Security settings in BlueSky.
The Network is always: AT
Credential type | Req | Value |
---|---|---|
AccountName |
Required | Your account name, eg. instantiator.bsky.social |
AppPassword |
Required | An application password created in your account |
Server |
The AT network server to connect to, if not bsky.social |
eg. The following line defines the AccountName
variable for an AT
account with prefix TEST1
, in the format of a .env
configuration file:
TEST1_AT_AccountName="presence-lib-test.bsky.social"
You must provide both AccountName
and AppPassword
to be able to connect to an AT network.
The Server
value is optional, and can be used to indicate the AT service the account is with, if it is not bsky.social
.
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.