33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
# File 'lib/gleis/database.rb', line 33
def self.info(app_name)
token = Token.check
url = Config.get_env_var(app_name, token, 'DATABASE_URL')
abort_message = 'You do not have a database or you did not promote it yet. '\
'You can create one with the db:new command and promote it with db:promote.'
abort(abort_message) unless url
db_name = url.split('/').last
body = API.request('get', "database/#{db_name}", token)
return unless body['success'] == 1
db = body['database']
puts "Info about database at DATABASE_URL:\n\n"
puts "\tName:\t\t#{db['name']}\n" \
"\tCreated on:\t#{Time.parse(db['created_at']).strftime('%c')}"
if body['available']
puts "\tStatus:\t\tavailable\n" \
"\tDatabase:\t#{body['version']}\n" \
"\tConnections:\t#{body['connections']}"
else
puts "\tStatus:\t\tnot available"
end
end
|