Skip to content

Changing the connection strings? #5

@vegardlarsen

Description

@vegardlarsen

I had a discussion with a colleague this morning regarding the connection string format. The goal was the possibility to add certain templated fields to each destination. Say that you want to change the e-mail subject field to make it easier to sort the e-mail, or perhaps you want files stored via ftp to be stored hierarchically in folders: {application}/{version}/{exception}/{timestamp}.zip

We think a lot can be achieved by moving away from connection strings and replacing them with full XML elements, something like this:

<nbug>
    <connection>
        <type>ftp</type>
        <uri>ftp://www.example.com/asdf</uri>
        <username></username>
        <password></password>
        <filenameFormat>Exception_{timestamp}.zip</filenameFormat>
    </connection>
    <connection>
        <type>email</type>
        <server>smtp.example.com</server>
        <port>25</port>
        <username></username>
        <password></password>
        <subject>{version} - {exception} - {method}</subject>
        <template>Hi, an exception was logged: {exception}
            {stacktrace}

            Best regards,
            {applicationName} {version}
        </template>
        <filenameFormat>Exception_{timestamp}.zip</filenameFormat>
    </connection>
    <connection>
        <type>azureblobstorage</type>
        <sharedAccessSignature>1234567890abcdef</sharedAccessSignature>
        <accountName>example</accountName>
        <filenameFormat>{applicationName}/{version}/{exception} {method}/{timestamp}.zip</filenameFormat>
    </connection>
</nbug>

To implement this in the best possible way, I assume we'll change the protocol interface to something like this:

public interface IProtocol<T>
    where T: IProtocolSettings
{
    bool Send(T settings, Stream file);
}

Is this a good idea?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions