File-Based Configuration

More and more applications I write use configuration files. This lets me version them in GIT. IsItSQL uses JSON files that are painful to edit. Starting with 1.8, IsItSQL supports file-based configuration for the servers using .HCL files.

File-based configuration looks for servers to monitor in *.hcl files in the servers folder. It supports multiple HCL files in subdirectories.

Getting Started

In the optional folder, there are two executables:

The steps to migrate to HCL file-based configuration are:

  1. Copy these two exeutables up to the IsItSQL folder
  2. Run cfg2file.exe. It will make the servers folder and create servers.isitsql.hcl and ag_names.hcl in that folder.
  3. Restart IsItSQL. Look for a log entry like config mode: FILE. The old mode will log config mode: GUI.
  4. Edit your HCL files. IsItSQL polls them for changes every minute and completely rereads them every hour.

File Structure

The servers folder can have any number of HCL files. A given HCL file can have:

Server Block

The simplest form of the HCL entry is:

server "D40\SQL2014" {}

The full form is:

server "db-txn" {
    server = "D40\SQL2019"
    display_name "txn-server"
    key = "txn1"
    tags = ["prod", "dc1"]
    credential = "sqlmonitor"
    ignore_backups = false
    ignore_backups_list = ["a", "b"]
}

The fields are:

Defaults Block

Each HCL file can have a defaults section:

defaults {
    tags = ["prod", "dc1"]
    credential = "sqlmonitor"
    ignore_backups = false
    ignore_backups_list = ["a", "b"]
}

These defaults are assigned to all servers in the file.

Availability Group Names Block

We can assign display names to Availability Groups. This is used in the Availability Group page to display a different name on the screen. I try to use a static DNS entry on top of the Listener. This lets me display that static DNS instead of the Listener.

ag_name {
  domain       = "PROD"
  name         = "Listen01P"
  display_name = "db-txn"
}

Editing with VSCode

Notes