Skip to content

Commit d51cc54

Browse files
timothysmith0609tsontario
authored andcommitted
Remove redundant imports, tweak README
Fixes README, buildscript, screenshot updates README fixes README
1 parent 81e2a9b commit d51cc54

File tree

9 files changed

+18
-14
lines changed

9 files changed

+18
-14
lines changed

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
# Avoid CloudSQL Console Slowdowns
2-
Easily navigate to the db you want
2+
Navigating Google Cloud Console's SQL list can be annoyingly slow once your instances grow beyond a certain size. Avoid the pain with this Alfred workflow that grabs and caches all your SQL instance names for a given project and lets you search them easily. Once you find the instance you're looking for just press `enter` and your browser will open with the dashboard for that instance. Easy!
33

44
## Included
5-
- A simple go client to connect to the SQL API and list instances. Just run `./build` in the `go` directory of the workflow.
5+
- A simple go client to connect to the SQL API and list instances. Just run `./build` in the `go` directory of the workflow and add the resulting `cloudsql` binary to `CLOUD_SQL_PATH` in the workflow environment variables (see pic below). Built with Go 1.9.2
66

77
## Requirements
88
- Alfred 3
9+
- Go 1.9.2
910

1011
## Usage
1112

1213
`csql [QUERY]`
1314

1415
Press enter to open the CloudSQL instance in your browser
15-
![csql invocation](screenshots/DBlist.png)
16+
![csql invocation](screenshots/instance_list.png)
1617

1718
`csql-refresh`
1819

@@ -24,21 +25,20 @@ press enter to update the cache of CloudSQL instances (default TTL = 300 seconds
2425
**1. Install the workflow**
2526

2627
You can download the workflow from the [releases page](#)
27-
This workflow requires Alfred 3.
28+
You will need to run `./build` in the `./go` directory of the workflow in order to install the client that fetches the list of your DB instances. Please note that this workflow requires Alfred 3.
2829

2930
**2. Environment variables**
3031
- Set `CLOUD_SQL_PATH` to the location of the `cloudsql` binary (source included in `go` folder)
31-
- Set `PROJECT` to the name of the Google project you want to search. This workflow uses the `golang.org/x/oauth2/google` library and loads your system's default auth, so make sure it accords with the `PROJECT` variable.
32+
- Set `PROJECT` to the name of the Google project you want to search.
33+
3234
![goto environment settings](screenshots/env_options.png)
35+
3336
![set env vars](screenshots/env_vars.png)
3437

3538
**3. Credentials**
3639

37-
This implementation relies on the calling program (pointed to by `CLOUD_SQL_PATH`) to properly set up the client. Check the Google docs if you require more information on authenticating.
38-
39-
**4. Ruby Dependencies**
40+
This workflow uses your default gcloud credentials (usually set via `gcloud auth application-default login`). Make sure your current identity has access to the target project.
4041

41-
This workflow is built and tested with Ruby 2.3.3. You will also need the `google-api-client` gem installed on your system. Run `gem install google-api-client` to install the necessary gem.
4242

4343

4444

csql

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
#!/usr/bin/env ruby
22

3-
require 'google/apis/sqladmin_v1beta4'
43
require 'json'
54
require 'open3'
6-
require 'pry'
5+
require 'time'
76

87
BASE_PATH = "https://console.cloud.google.com/sql/instances/"
98
CACHE_FILE = "#{ENV["HOME"]}/.csql_cache.json"

go/build

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1+
echo "Building ./cloudsql..."
12
go build -o cloudsql
3+
if [ $? -eq 0 ]
4+
then
5+
echo "Built cloudsql!, Don't forget to update the CLOUD_SQL_PATH workflow variable in Alfred!"
6+
else
7+
echo "Something went wrong! \`go build -o cloudsql\` exited with code $?"
8+
fi

info.plist

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
<dict>
55
<key>bundleid</key>
66
<string>com.timothysmith.googlecloud</string>
7-
<key>category</key>
8-
<string>Tools</string>
97
<key>connections</key>
108
<dict>
119
<key>023D51FE-9EC7-44C5-8F61-0458085261B9</key>
@@ -247,7 +245,7 @@ A small go client has been packaged with this workflow that will fetch all the i
247245
<key>variables</key>
248246
<dict>
249247
<key>CLOUD_SQL_PATH</key>
250-
<string>/Users/timothysmith/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.950863E3-8BD4-42D2-B69D-5DAC7B2DEF02/go/cloudsql</string>
248+
<string>/Users/timothysmith/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.2F663F06-C7E0-42FD-BA2F-18C05179C1DC/go/cloudsql</string>
251249
<key>PROJECT</key>
252250
<string>shopify-tiers</string>
253251
</dict>

screenshots/DBlist.png

-77 KB
Binary file not shown.

screenshots/cache_refresh.png

-20.4 KB
Loading

screenshots/env_options.png

-13.2 KB
Loading

screenshots/env_vars.png

-7.71 KB
Loading

screenshots/instance_list.png

51.8 KB
Loading

0 commit comments

Comments
 (0)