Add dotenv
This commit is contained in:
parent
259856a033
commit
6d59938e0d
|
@ -0,0 +1,8 @@
|
|||
LDAP_HOST=192.168.33.10
|
||||
LDAP_PORT=389
|
||||
#
|
||||
# Production LDAP server:
|
||||
#
|
||||
# LDAP_HOST=ldap.kosmos.org
|
||||
# LDAP_PORT=636
|
||||
# LDAP_USE_TLS=true
|
|
@ -36,3 +36,6 @@
|
|||
/yarn-error.log
|
||||
yarn-debug.log*
|
||||
.yarn-integrity
|
||||
|
||||
# Ignore local dotenv config file
|
||||
.env
|
||||
|
|
2
Gemfile
2
Gemfile
|
@ -25,6 +25,8 @@ gem 'jbuilder', '~> 2.7'
|
|||
# Reduces boot times through caching; required in config/boot.rb
|
||||
gem 'bootsnap', '>= 1.4.2', require: false
|
||||
|
||||
gem 'dotenv-rails', groups: [:development, :test]
|
||||
|
||||
gem 'net-ldap'
|
||||
|
||||
group :development, :test do
|
||||
|
|
|
@ -75,6 +75,10 @@ GEM
|
|||
crass (1.0.6)
|
||||
database_cleaner (1.8.5)
|
||||
diff-lcs (1.4.4)
|
||||
dotenv (2.7.2)
|
||||
dotenv-rails (2.7.2)
|
||||
dotenv (= 2.7.2)
|
||||
railties (>= 3.2, < 6.1)
|
||||
erubi (1.9.0)
|
||||
ffi (1.13.1)
|
||||
globalid (0.4.2)
|
||||
|
|
|
@ -24,9 +24,9 @@ class LdapUsersController < ApplicationController
|
|||
private
|
||||
|
||||
def ldap_client
|
||||
ldap_client ||= Net::LDAP.new host: "ldap.kosmos.org",
|
||||
port: 636,
|
||||
encryption: :simple_tls,
|
||||
ldap_client ||= Net::LDAP.new host: ENV['LDAP_HOST'],
|
||||
port: ENV['LDAP_PORT'],
|
||||
encryption: ENV['LDAP_USE_TLS'] ? :simple_tls : nil,
|
||||
auth: {
|
||||
method: :simple,
|
||||
username: Rails.application.credentials.ldap[:username],
|
||||
|
|
Loading…
Reference in New Issue