#884 Add option to configure DB port
Merged 4 years ago by mikem. Opened 4 years ago by alexi.
Unknown source dbport  into  master

Keep None as the default DBPort
Alex Iribarren • 4 years ago  
Add option to configure DB port
Alex Iribarren • 4 years ago  
file modified
+1
@@ -10,6 +10,7 @@

  DBName = koji

  DBUser = koji

  #DBHost = db.example.com

+ #DBPort = 5432

  #DBPass = example_password

  KojiDir = /mnt/koji

  

file modified
+3 -1
@@ -400,6 +400,7 @@

          ['DBUser', 'string', None],

          ['DBHost', 'string', None],

          ['DBhost', 'string', None],   # alias for backwards compatibility

+         ['DBPort', 'integer', None],

          ['DBPass', 'string', None],

          ['KojiDir', 'string', None],

  
@@ -665,7 +666,8 @@

          koji.db.provideDBopts(database=opts["DBName"],

                                user=opts["DBUser"],

                                password=opts.get("DBPass", None),

-                               host=opts.get("DBHost", None))

+                               host=opts.get("DBHost", None),

+                               port=opts.get("DBPort", None))

      except Exception:

          tb_str = ''.join(traceback.format_exception(*sys.exc_info()))

          logger.error(tb_str)

The Koji hub does not have an option to configure the port for the DB server, and psycopg2 doesn't allow you to pass a "server:port" string as a host. This pull request adds the missing DBPort option.

Looks fine, except the default value should continue to be None.

1 new commit added

  • Keep None as the default DBPort
4 years ago

2 new commits added

  • Keep None as the default DBPort
  • Add option to configure DB port
4 years ago

5432 is the default port of the underlying library, but OK.

Commit df56213 fixes this pull-request

Pull-Request has been merged by mikem

4 years ago