Skip to content

Configuration

Michael Brown edited this page Feb 13, 2023 · 6 revisions

Binner Configuration

All configuration is set in appsettings.json located along the Binner.Web executable. Any changes to the configuration require a restart of the service. We do plan to allow configuration changes in the application in the near future to make this a little easier.

Example default configuration

// appsettings.json
{
  "WebHostServiceConfiguration": {
    // Development,Production
    "Environment": "Production",
    "Name": "Binner Server",
    "IP": "*",
    "PublicUrl": "",
    "Port": 8090,
    // caching configuration
    "MaxCacheItems": 1024,
    "CacheSlidingExpirationMinutes": 30,
    "CacheAbsoluteExpirationMinutes": 0,
    "Integrations": {
      "Swarm": {
        "Enabled": true,
        // Binner Swarm Api keys can be obtained at https://binner.io/swarm
        // This is optional, by using a registered key you can obtain a higher request limit.
        "ApiKey": "",
        // Binner Swarm Api Url
        "ApiUrl": "https://swarm.binner.io"
      },
      "Octopart": {
        "Enabled": false,
        // Octopart API Keys can be obtained at https://octopart.com/api/home
        "ApiKey": "",
        // Octopart Api Url
        "ApiUrl": "https://octopart.com"
      },
      "Digikey": {
        "Enabled": false,
        // Digikey API Keys can be obtained at https://developer.digikey.com/
        "ClientId": "",
        "ClientSecret": "",
        // The oAuth Postback Url - this must match the Callback Url for the App you configured on Digikey's API
        "oAuthPostbackUrl": "https://localhost:8090/Authorization/Authorize",
        // Digikey Api Url using either https://sandbox-api.digikey.com, https://api.digikey.com
        "ApiUrl": "https://api.digikey.com"
      },
      "Mouser": {
        "Enabled": false,
        // Mouser API Keys can be obtained at https://www.mouser.com/api-hub/
        "ApiKeys": {
          "SearchApiKey": "",
          "OrderApiKey": "",
          "CartApiKey": ""
        },
        // Mouser Api Url
        "ApiUrl": "https://api.mouser.com"
      },
      // AliExpress API is not currently supported
      "AliExpress": {
        "Enabled": false,
        "ApiKey": "",
        // The oAuth Postback Url - this must match the Callback Url for the App you configured on AliExpress API
        "oAuthPostbackUrl": "https://localhost:8090/Authorization/Authorize",
        // AliExpress Api Url
        "ApiUrl": "https://api.aliexpress.com"
      }
    },
    "PrinterConfiguration": {
      // DYMO LabelWriter 450, DYMO LabelWriter 450 Twin Turbo
      "PrinterName": "DYMO LabelWriter 450 Twin Turbo",
      // Default or Left,Right for DYMO LabelWriter 450 Twin Turbo
      "PartLabelSource": "Right",
      // Label name, such as 30346 or 30277)
      "PartLabelName": "30346",
      "PartLabelTemplate": {
        "Line1": {
          "label": 2,
          "content": "{partNumber}",
          "fontName": "Segoe UI",
          "fontSize": 16,
          "autoSize": true,
          "upperCase": true
        },
        "Line2": {
          "label": 2,
          "content": "{description}",
          "fontName": "Segoe UI",
          "fontSize": 8
        },
        "Line3": {
          "label": 2,
          "content": "{description}",
          "fontName": "Segoe UI",
          "fontSize": 8
        },
        "Line4": {
          "label": 2,
          "content": "{partNumber}",
          "barcode": true
        },
        "Identifier": {
          "label": 1,
          "content": "{binNumber}",
          "fontName": "Source Code Pro",
          "fontSize": 10,
          "color": "#ee0000",
          "rotate": 90,
          "position": "left",
          "upperCase": true,
          "margin": {
            "top": 25
          }
        },
        "Identifier2": {
          "label": 1,
          "content": "{binNumber2}",
          "fontName": "Source Code Pro",
          "fontSize": 10,
          "color": "#ee0000",
          "rotate": 90,
          "position": "right",
          "upperCase": true,
          "margin": {
            "top": 25,
            "left": 20
          }
        }
      },
      "LabelDefinitions": [
        {
          "MediaSize": {
            "ModelName": "30277",
            "Name": "File Folder (2 up)",
            "DriverName": "w82h248",
            "ExtraData": "",
            "Width": 82,
            "Height": 248
          },
          "TopMargin": -20,
          "LeftMargin": 0,
          "LabelCount": 2,
          "TotalLines": 2
        },
        {
          "MediaSize": {
            "ModelName": "30346",
            "Name": "1/2 in x 1-7/8 in",
            "DriverName": "w36h136",
            "ExtraData": "",
            "Width": 36,
            "Height": 136
          },
          "TopMargin": -20,
          "LeftMargin": 0,
          "LabelCount": 2,
          "TotalLines": 2
        },
        {
          "MediaSize": {
            "ModelName": "30252",
            "Name": "Address",
            "DriverName": "w79h252",
            "ExtraData": "",
            "Width": 79,
            "Height": 252
          },
          "TopMargin": -20,
          "LeftMargin": 0,
          "LabelCount": 1,
          "TotalLines": 4
        },
        {
          "MediaSize": {
            "ModelName": "30327",
            "Name": "File Folder",
            "DriverName": "w57h248",
            "ExtraData": "",
            "Width": 57,
            "Height": 286
          },
          "TopMargin": -20,
          "LeftMargin": 0,
          "LabelCount": 1,
          "TotalLines": 4
        }
      ]
    }
  },
  "StorageProviderConfiguration": {
    // Provider options: Binner, SqlServer, Postgresql, MySql, Sqlite
    "Provider": "Binner",
    "ProviderConfiguration": {
      "Filename": "C:\\Binner\\binner.db" // Binner provider
      // "ConnectionString": "Server=localhost;Database=Binner;Trusted_Connection=True;TrustServerCertificate=True;Integrated Security=True;" // SqlServer provider
      // "ConnectionString": "Server=localhost;Port=5432;Database=Binner;Userid=postgres;Password=password;SslMode=Disable;Persist Security Info=true;" // Postgresql provider
      // "ConnectionString": "Data Source=C:\\Binner\\binner_sqlite.db; Version=3; Pooling=True; Max Pool Size=100;" // Sqlite provider
      // "ConnectionString": "Server=localhost;Database=Binner;Uid=root;Pwd=password;" // MySql provider
    },
    // the path to store user uploaded files to
    "UserUploadedFilesPath": "C:\\Binner\\UserFiles"
  },
  "Logging": {
    "LogLevel": {
      "Default": "Trace",
      "Microsoft": "Error"
    }
  }  
}

IP/Port settings

By default, Binner is configured to listen on all local IP addresses * on Port 8090. You can change the desired IP by specifying the IP Address to listen on. Port can be any numeric value from 0-65535, but it is recommended to stay between 1024-65535. Https is now required so accessing the server is done via https://localhost:8090

Environment

Unless running from source in Visual Studio, it is recommended to set the Environment to Production. This disables developer features in the Web server so exception stack traces are not displayed.

MaxCacheItems

This is the total number of items kept in the web response cache. Setting this to 0 will disable all caching.

Integrations

Each section is dedicated to external API integrations that Binner supports. Currently this is Swarm, Digikey, Mouser, Octopart and AliExpress.

PrinterConfiguration

Binner supports automatic part label printing as well as custom label printing. Part label printing is of a specific format that can include barcodes, and part information. See Printing Configuration for specific details on configuring printing.

StorageProviderConfiguration

Binner can store your part information using different physical storage providers. The default provider Binner will store your inventory in a binary custom database file format. Alternatively, you can use providers such as SqlServer or any other providers currently available for Binner. See Storage Provider Configuration for specific details on configuring storage providers.