Skip to content
This repository has been archived by the owner on Aug 16, 2018. It is now read-only.
/ dbcc Public archive

This is a database superuser agent which listens http port, check if requested database & user exists and create them otherwise.

License

Notifications You must be signed in to change notification settings

LeKovr/dbcc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dbcc

Build Status Build Status GoRelease GoCard

dbcc - Database check & create tool.

This is a database superuser agent which

  • listens http port
  • gets authorized requests with name
  • check if requested database name & user name exists and create them otherwise.

Only postgresql database supported now.

Make

$ go build

If you need cross platform build with gox, run $ make buildall

Tests

With mock database: $ go test

With real database server:

# set connection vars in ENV and run
$ DBCC_TEST_DB=1 PGUSER=op go test

Run

$ gosu postgres ./dbcc --key=YOUR_SECRET_KEY

or

$ APP_KEY=YOUR_SECRET_KEY gosu postgres ./dbcc

Usage

curl "http://$DB_HOST:8080/?key=YOUR_SECRET_KEY&name=operator&pass=operator_pass[&tmpl=template]"

Will do the following:

  • if user operator does not exists then create it with password operator_pass
  • if database operator does not exists then create it with owner operator and template template (default template1)

and return

  • OK: 00 if nothing was done
  • OK: 10 if db created (user exists)
  • OK: 11 if user & db created

License

The MIT License (MIT)

Copyright (c) 2015 Alexey Kovrizhkin lekovr@gmail.com

About

This is a database superuser agent which listens http port, check if requested database & user exists and create them otherwise.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published