Skip to content

Commit

Permalink
Pull domain from stack, don't default to aptible.in (#269)
Browse files Browse the repository at this point in the history
* Pull domain from stack, don't default to aptible.in

* Default to xenial

* Remove codecov since it doesn't support all tested Ruby versions

* Fix tests that test localhost.aptible.in domain
  • Loading branch information
almathew authored Sep 18, 2020
1 parent 79b1b04 commit a3dfb02
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 20 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
dist: xenial
sudo: false

rvm:
Expand Down
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ gem 'rack', '~> 1.0'

group :test do
gem 'webmock'
gem 'codecov', '~> 0.1.0', require: false
end

# Specify your gem's dependencies in aptible-cli.gemspec
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
[![Gem Version](https://badge.fury.io/rb/aptible-cli.png)](https://rubygems.org/gems/aptible-cli)
[![Build Status](https://travis-ci.org/aptible/aptible-cli.png?branch=master)](https://travis-ci.org/aptible/aptible-cli)
[![Dependency Status](https://gemnasium.com/aptible/aptible-cli.png)](https://gemnasium.com/aptible/aptible-cli)
[![codecov](https://codecov.io/gh/aptible/aptible-cli/branch/master/graph/badge.svg)](https://codecov.io/gh/aptible/aptible-cli)
[![Roadmap](https://badge.waffle.io/aptible/aptible-cli.svg?label=ready&title=roadmap)](http://waffle.io/aptible/aptible-cli)

Command-line interface for Aptible services.
Expand Down
8 changes: 1 addition & 7 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ environment:
- RUBY_VERSION: 23

install:
# The SSL_CERT_* environment variables are here since otherwise calls to
# codecov.io wtill not work. These variables do have to be set in order for
# the gem to make calls to the Aptible API, since otherwise Ruby will fail
# with a certificate verification error.
- set SSL_CERT_DIR=%PROGRAMFILES%\Git\mingw64\ssl\certs
- set SSL_CERT_FILE=%PROGRAMFILES%\Git\mingw64\ssl\cert.pem
# Override PATHEXT so our ssh bat file has a higher precedence.
- set PATHEXT=.BAT;.COM;.EXE;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
- set PATH=C:\Ruby%RUBY_VERSION%-x64\bin;%PATH%
Expand All @@ -28,4 +22,4 @@ before_test:
- bundle -v

test_script:
- bundle exec rake ci
- bundle exec rake ci
5 changes: 3 additions & 2 deletions lib/aptible/cli/helpers/database.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,11 @@ def with_postgres_tunnel(database)

def local_url(credential, local_port)
remote_url = credential.connection_url
uri = URI.parse(remote_url)

uri = URI.parse(remote_url)
domain = credential.database.account.stack.internal_domain
"#{uri.scheme}://#{uri.user}:#{uri.password}@" \
"localhost.aptible.in:#{local_port}#{uri.path}"
"localhost.#{domain}:#{local_port}#{uri.path}"
end

def find_credential(database, type = nil)
Expand Down
4 changes: 3 additions & 1 deletion spec/aptible/cli/subcommands/db_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ class SocatHelperMock < OpenStruct
end

let(:handle) { 'foobar' }
let(:database) { Fabricate(:database, handle: handle) }
let(:stack) { Fabricate(:stack, internal_domain: 'aptible.in') }
let(:account) { Fabricate(:account, stack: stack) }
let(:database) { Fabricate(:database, handle: handle, account: account) }
let(:socat_helper) { SocatHelperMock.new(port: 4242) }

describe '#db:create' do
Expand Down
8 changes: 0 additions & 8 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@

Bundler.require :development

require 'simplecov'
SimpleCov.start

if ENV['CI']
require 'codecov'
SimpleCov.formatter = SimpleCov::Formatter::Codecov
end

# Load shared spec files
Dir["#{File.dirname(__FILE__)}/shared/**/*.rb"].each do |file|
require file
Expand Down

0 comments on commit a3dfb02

Please sign in to comment.