Skip to content

Commit

Permalink
Merge pull request #68 from hathitrust/DEV-1478_db_credentials_from_ENV
Browse files Browse the repository at this point in the history
DEV-1478 hathifiles: update which env vars it uses
  • Loading branch information
aelkiss authored Jan 24, 2025
2 parents db0c35f + 9f245aa commit e394a06
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 118 deletions.
5 changes: 2 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ GIT

GIT
remote: https://github.com/hathitrust/hathifiles_database.git
revision: 254667029a039557748431a547333eaa315d1f7b
revision: 0939c84c8af95757fc00ea9be16f7247709643ee
branch: main
specs:
hathifiles_database (0.4.1)
hathifiles_database (0.5.0)
date_named_file
dotenv
ettin
Expand Down Expand Up @@ -246,7 +246,6 @@ DEPENDENCIES
fast_jsonparser
filter!
hathifiles_database!
httpclient
marc
milemarker
mysql2
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Tests](https://github.com/hathitrust/hathifiles/actions/workflows/ci.yml/badge.svg)](https://github.com/hathitrust/hathifiles/actions/workflows/ci.yml)
[![Test Status](https://github.com/hathitrust/hathifiles/actions/workflows/tests.yml/badge.svg)](https://github.com/hathitrust/hathifiles/actions/workflows/tests.yml)
[![Coverage Status](https://coveralls.io/repos/github/hathitrust/hathifiles/badge.svg?branch=main)](https://coveralls.io/github/hathitrust/hathifiles?branch=main)
[![Ruby Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://github.com/testdouble/standard)

Expand Down
7 changes: 0 additions & 7 deletions config/environments/production.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
database:
opts:
adapter: 'mysql2'
host: <%= ENV['DB_HOST'] %>
database: <%= ENV['DB_DATABASE'] %>
user: <%= ENV['DB_USER'] %>
password: <%= ENV['DB_PASSWORD'] %>
hathifiles_web_path: <%= ENV['HATHIFILES_WEB_PATH'] %>
zephir_dir: <%= ENV['ZEPHIR_DIR'] %>
hathifiles_dir: <%= ENV['HATHIFILES_DIR'] %>
Expand Down
2 changes: 0 additions & 2 deletions config/settings.yml

This file was deleted.

5 changes: 4 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ services:
mariadb: *healthy
pushgateway: *healthy
environment:
MYSQL_CONNECTION_STRING: "mysql2://ht_rights:ht_rights@mariadb/ht"
MARIADB_HT_RO_USERNAME: ht_rights
MARIADB_HT_RO_PASSWORD: ht_rights
MARIADB_HT_RO_HOST: mariadb
MARIADB_HT_RO_DATABASE: ht
PUSHGATEWAY: http://pushgateway:9091

mariadb:
Expand Down
62 changes: 0 additions & 62 deletions lib/database.rb

This file was deleted.

1 change: 0 additions & 1 deletion lib/hathifiles.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

require_relative "bib_record"
require_relative "collections_database/collections"
require_relative "database"
require_relative "hathifile_history/records"
require_relative "hathifile_history/record"
require_relative "hathifile_history/htid_history_entry"
Expand Down
12 changes: 10 additions & 2 deletions lib/services.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,23 @@

require "canister"
require "sequel"
require "database"
require "collections_database/collections"
require "sdr_num_prefixes"
require "logger"

Services = Canister.new

Services.register(:db) do
Database.new
# Read-only connection to database for verifying rights DB vs .rights files
# as well as hathifiles tables.
Sequel.connect(
adapter: "mysql2",
user: ENV["MARIADB_HT_RO_USERNAME"],
password: ENV["MARIADB_HT_RO_PASSWORD"],
host: ENV["MARIADB_HT_RO_HOST"],
database: ENV["MARIADB_HT_RO_DATABASE"],
encoding: "utf8mb4"
)
end

Services.register(:collections) do
Expand Down
39 changes: 0 additions & 39 deletions spec/database_spec.rb

This file was deleted.

0 comments on commit e394a06

Please sign in to comment.