presence

Network specific configuration

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.

Accounts

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.

Configuration keys

Each configuration key is constructed as follows:

<AccountPrefix>_<Network>_<CredentialType>

For example:

These combined to give a key of: TEST1_AT_AccountName

Networks

Each network requires specific configuration keys.

Console network

The 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) network

Create 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.

Configuration variables

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>"

Example 1: Environment variables

Presence.SocialFormat.Console -f SampleData/SimpleThread.md -n AT,Console | Presence.Posting.Console

Example 2: -e / --env-file parameter

Presence.SocialFormat.Console -f SampleData/SimpleThread.md -n AT,Console | Presence.Posting.Console -e .env.example

Configuration by JSON

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:

This key supercedes any others found in the configuration.

Example 1: PRESENCE_CONFIG_JSON as an environment variable

Sample 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

Example 2: PRESENCE_CONFIG_JSON variable in a .env file

Filename: .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

Example 3: -j / --json-config parameter

Invoke 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.