npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

azure-sql-agent

v0.1.3

Published

Command line agent to register rules in the Azure SQL firewall for the device the agent is running on.

Downloads

12

Readme

azure-sql-agent

Command line agent to automatically add your current public IP address to the Azure SQL firewall.

Screenshot

Installation

You will need the Azure CLI installed. Then just run

$ yarn add azure-sql-agent
$ ./node_modules/azure-sql-agent/lib/azure-sql-agent.js

You can also install the package globally: yarn global add azure-sql-agent

Configuration

All SQL servers for which you want to automatically setup firewall rules have to be configured. The configuration file is expected to be in ~/.azure-sql-agent/config.json:

{
    'prefix': 'my-prefix',
    'notifications': false,
    'errorNotifications': true,
    'servers': [
        {
            'subscription': 'hex-subscription-id',
            'resourceGroup': 'resource-group-name',
            'name': 'server-name'
        }
    ]
}

The prefix is a personal name that is used to distinguish the firewall rules. When running the agent, other rules with this prefix will be removed, as they are expected to be old rules that have been created by earlier runs.

Set notifications to true if you would like to have a small window pop up whenever the firewall rules have been updated.

Set errorNotifications to false if you do not want to be informed when the agent crashes. Errors usually occur when the Azure API takes too long to respond.

The subscription is the full identifier of your Azure subscription. You can see the currently active subscription in the id field when issueing az account show.

The options resourceGroup and name identify the specific SQL server.

Usage

Make sure to run az login before you run the agent, as it requires an existing authentication.

After the configuration is complete, run the agent:

$ ./node_modules/azure-sql-agent/lib/azure-sql-agent.js
Agent is running now: 70295

To start the agent in the foreground, use -f. A full list of options is displayed when using --help.

Reloading

The agent automatically checks for changes in your internal IP address every second, assuming that a new local IP address has been assigned due to switching the WiFi network, for example. This triggers a check if your public IP has also changed.

Additionally, the agent checks if your public IP has changed every 5 minutes.

Any changes in your configuration file trigger a full reload, where all firewall rules will be checked, regardless of any IP address changes. You could also trigger this reload manually by using touch ~/.azure-sql-agent/config.json.

Stopping

The process ID will be written to ~/.azure-sql-agent/agent.pid. To stop the agent, you can run

$ kill $(cat ~/.azure-sql-agent/agent.pid)

License

The Azure SQL Agent is licensed under the MIT License