Memory Resolver Tutorial

    The basic configuration for the server requires:

    • The operator JWT
    • resolver_preload set to an object where account public keys are mapped to account JWTs.

    Let’s create the setup:

    The nsc tool can generate a configuration file automatically. You provide a path to the server configuration. The nsc tool will generate the server config for you:

    1. Success!! - generated "/tmp/server.conf"

    You can then test it.

    While generating a configuration file is easy, you may want to craft one by hand to know the details. With the entities created, and a standard location for the .nsc directory. You can reference the operator JWT and the account JWT in a server configuration or the JWT string directly. Remember that your configuration will be in $NSC_HOME/nats/<operator_name>/<operator_name>.jwt for the operator. The account JWT will be in $NSC_HOME/nats/<operator_name>/accounts/<account_name>/<account_name>.jwt

    For the configuration you’ll need:

    • The path to the operator JWT
    • A copy of the contents of the account JWT file
    1. resolver: MEMORY
    2. resolver_preload: {
    3. <public key for an account>: <contents of the account jwt>
    4. ### add as many accounts as you want
    5. ...

    In this example this translates to:

    Save the config at server.conf and start the server:

    1. > nats-server -c server.conf

    You can then .