search

Home  >  Q&A  >  body text

How can we pass SSL parameters to MySQL in Gramex's FormHandler?

I use this gramex.yaml to configure the MySQL database connected to OTP:

otp:
    url: 'mysql+pymysql://$USER:$PASS@$MYSQL_SERVER/$DB'
    table: $TABLE

When Gramex starts, it reports an exception:

InternalError: (pymysql.err.InternalError) (3159, 'Connections using insecure transport are prohibited while --require_secure_transport=ON.')

This answer suggests passing a dummy ssl: dictionary.

How to pass it to Gramex's FormHandler?

P粉558478150P粉558478150234 days ago425

reply all(1)I'll reply

  • P粉592085423

    P粉5920854232024-04-03 12:30:52

    There are two possibilities. If you don't have an SSL certificate to connect to the database, use:

    otp:
      url: 'mysql+pymysql://$USER:$PASS@$MYSQL_SERVER/$DB'
      table: $TABLE
      connect_args:
        ssl:
          fake_flag_to_enable_tls: true
    

    If you have an SSL CA certificate in PEM format, use:

    otp:
      url: 'mysql+pymysql://$USER:$PASS@$MYSQL_SERVER/$DB'
      table: $TABLE
      connect_args:
        ssl_ca: /path/to/ca-certificate.pem
    

    You can pass any additional parameters to the pymysql connection object .

    reply
    0
  • Cancelreply