#  Copyright (c) 1997-2021
#  Ewgenij Gawrilow, Michael Joswig, and the polymake team
#  Technische Universität Berlin, Germany
#  https://polymake.org
#
#  This program is free software; you can redistribute it and/or modify it
#  under the terms of the GNU General Public License as published by the
#  Free Software Foundation; either version 2, or (at your option) any
#  later version: http://www.gnu.org/licenses/gpl.txt.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#-------------------------------------------------------------------------------
#
#  This file is part of the polymake database interface polyDB.
#
#   @author Silke Horn, Andreas Paffenholz
#   http://www.mathematik.tu-darmstadt.de/~paffenholz
#   (c) 2010-2019
#


CREDIT polyDB
   Access to the polymake polytope database.
   (c) 2013-2019 Silke Horn, Andreas Paffenholz
   http://www.mathematik.tu-darmstadt.de/~paffenholz

CONFIGURE {
   eval { require MongoDB; };
   if ($@) {
      die "Could not load perl MongoDB module: $@\n\nSee 'help \"install_mongodb\";' for an installation guide.\n";
   } else {
      return 1;
   }
}

require PolyDB;

HELP
  db_help.rules

INCLUDE
  db_query.rules
  db_templates.rules
  db_info.rules
  db_insert.rules
  db_user_admin.rules
  db_collection_admin.rules


# @category Database Access
# Connect to PolyDB server, create a session object
#
# @param String host Host address of the PolyDB server in form "hostname" or "hostname:port";
#        default location is db.polymake.org, can be customized in $PolyDB::default::db_host
# @option String user user name for the database;
#         default is "polymake" with read-only access to all public collections, can be customized in $PolyDB::default::db_user
# @option String password password for the database; when omitted, will be prompted for in the polymake shell;
#         can be customized in $PolyDB::default::db_pwd
# @option String auth_db name of the authentication database where the user is defined;
#         default is "admin", can be customized in $PolyDB::default::db_auth_db
# @return PolyDB::Client
#
# @example [notest]
# Connect to the public polymake server as a user "polymake" with read-only permissions
# > $polyDB=polyDB();
# Connect to a local PolyDB server for testing purposes without authentication
# > $testDB=polyDB("localhost");
# Connect to a custom server with authentication, prompting for a password input
# > $otherDB=polyDB("otherdb.my.domain", user=>"myname");

user_function polyDB(;$ { user => undef, password => undef, auth_db => undef, port => undef, ssl => undef }) {
   new PolyDB::Client(@_);
}


# Local Variables:
# mode: perl
# cperl-indent-level:3
# indent-tabs-mode:nil
# End:
