Skip to content

Commit e6ae02f

Browse files
authored
use gnutls (#20)
* try gnutls * Allow GNUTLS to be toggled on and off * Update README.md
1 parent 40e1fb8 commit e6ae02f

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Or at least, that's the hope!
4040

4141
## Stack compatibility
4242

43-
This buildpack is tested primarily against the `cedar-18` stack.
43+
This buildpack is tested primarily against the `heroku-22` stack.
4444

4545
Allows for usage of [TinyTDS](https://github.com/rails-sqlserver/tiny_tds) on Heroku.
4646

@@ -94,6 +94,9 @@ Print TinyTDS build logs to the screen:
9494
echo -e "\n\n----------------------- $cmd------------------\n\n"; eval "$cmd"; done ; )
9595
```
9696

97+
### Connection Timeout
98+
If you receive connection timeout errors (e.g. "Adaptive Server connection failed"), consider whether TLS/gnutls is interacting poorly with heroku or the server where your mssql server lives. You can set the environment variable `heroku config:set USE_GNUTLS=" "` and temporarily set `heroku config:set FREETDS_REBUILD=true` to rebuild the code using TLS. See https://github.com/FreeTDS/freetds/issues/336 for more information.
99+
97100
License
98101
-------
99102

bin/compile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,12 @@ load_env_vars() {
5656
local env_var; env_var="${1:-}"
5757
until [ -z "$env_var" ]; do [ -f "$ENV_DIR/$env_var" ] && export "$env_var=$(cat "$ENV_DIR/$env_var")"; shift ; env_var="${1:-}" ; done
5858
}
59-
load_env_vars "FREETDS_VERSION" "FREETDS_ARCHIVE_NAME" "TDS_VERSION" "FREETDS_REBUILD"
59+
load_env_vars "FREETDS_VERSION" "FREETDS_ARCHIVE_NAME" "TDS_VERSION" "FREETDS_REBUILD" "USE_GNUTLS"
6060

6161
FREETDS_VERSION="${FREETDS_VERSION:-1.00.109}"
6262
FREETDS_ARCHIVE_NAME="${FREETDS_ARCHIVE_NAME:-freetds-${FREETDS_VERSION}}"
6363
TDS_VERSION="${TDS_VERSION:-7.3}" # or TDSVER
64+
USE_GNUTLS="${USE_GNUTLS:---with-gnutls}"
6465

6566
CACHED_TAR="${CACHE_DIR}/freetds-${FREETDS_VERSION}-heroku.tar.bz2"
6667
# Default rebuild to true since I'm having issues linking the library to tiny_tds gem with a cached build.
@@ -137,9 +138,16 @@ build_and_install_freetds() {
137138
# FreeTDS advises caching the build options as below
138139
# adding --disable-odbc making linking easier and we don't need it
139140
# adding --disable-debug to speed up compile
141+
142+
# As of Oct. 2022, heroku-22 stack currently only works with gnutls.
143+
# Allow this to be toggled off in the future with `export USE_GNUTLS=" "`
144+
# See https://github.com/FreeTDS/freetds/issues/336
145+
# and https://www.freetds.org/userguide/config.html
146+
# for more information.
140147
cat <<EOF > ".build_options"
141148
./configure \
142149
"--prefix=${APP_TARGET_DIR}" \
150+
"${USE_GNUTLS}" \
143151
--disable-odbc \
144152
--disable-debug \
145153
"--with-tdsver=${TDS_VERSION}"

0 commit comments

Comments
 (0)