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-error.log
|
||||||
yarn-debug.log*
|
yarn-debug.log*
|
||||||
.yarn-integrity
|
.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
|
# Reduces boot times through caching; required in config/boot.rb
|
||||||
gem 'bootsnap', '>= 1.4.2', require: false
|
gem 'bootsnap', '>= 1.4.2', require: false
|
||||||
|
|
||||||
|
gem 'dotenv-rails', groups: [:development, :test]
|
||||||
|
|
||||||
gem 'net-ldap'
|
gem 'net-ldap'
|
||||||
|
|
||||||
group :development, :test do
|
group :development, :test do
|
||||||
|
|
|
@ -75,6 +75,10 @@ GEM
|
||||||
crass (1.0.6)
|
crass (1.0.6)
|
||||||
database_cleaner (1.8.5)
|
database_cleaner (1.8.5)
|
||||||
diff-lcs (1.4.4)
|
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)
|
erubi (1.9.0)
|
||||||
ffi (1.13.1)
|
ffi (1.13.1)
|
||||||
globalid (0.4.2)
|
globalid (0.4.2)
|
||||||
|
|
|
@ -24,9 +24,9 @@ class LdapUsersController < ApplicationController
|
||||||
private
|
private
|
||||||
|
|
||||||
def ldap_client
|
def ldap_client
|
||||||
ldap_client ||= Net::LDAP.new host: "ldap.kosmos.org",
|
ldap_client ||= Net::LDAP.new host: ENV['LDAP_HOST'],
|
||||||
port: 636,
|
port: ENV['LDAP_PORT'],
|
||||||
encryption: :simple_tls,
|
encryption: ENV['LDAP_USE_TLS'] ? :simple_tls : nil,
|
||||||
auth: {
|
auth: {
|
||||||
method: :simple,
|
method: :simple,
|
||||||
username: Rails.application.credentials.ldap[:username],
|
username: Rails.application.credentials.ldap[:username],
|
||||||
|
|
Loading…
Reference in New Issue