Skip to content
Snippets Groups Projects
Commit 7edb2fcd authored by Mauricio Giacomini Girardello's avatar Mauricio Giacomini Girardello
Browse files

add orient db yaml file for dynamic configuration and fix the initializer

parent 3ddfb2b8
No related branches found
No related tags found
No related merge requests found
......@@ -17,4 +17,4 @@ production:
<<: *default
database: portalmec_production
username: portalmec
password: <%= ENV['PORTALMEC_DATABASE_PASSWORD'] %>
password: <%= ENV['PORTALMEC_DATABASE_PASSWORD'] %>
\ No newline at end of file
......@@ -4,22 +4,29 @@ require 'mina/git'
set :rails_env, 'production'
set :domain, 'portalmecdev.c3sl.ufpr.br'
set :deploy_to, "/home/portalmec/#{rails_env}"
set :app_path, "#{deploy_to}/#{current_path}"
set :domain, 'portalmecdev.c3sl.ufpr.br'
set :deploy_to, "/home/portalmec/#{rails_env}"
set :app_path, "#{deploy_to}/#{current_path}"
set :repository, 'git@gitlab.c3sl.ufpr.br:portalmec/portalmec.git'
set :branch, 'master'
set :user, 'portalmec'
set :branch, 'master'
set :user, 'portalmec'
task :environment do
#invoke :'rbenv:load'
end
task deploy: :environment do
deploy do
invoke :'git:clone'
queue %[echo "-----> Installing ruby gems"]
execute 'bundle install --binstubs'
execute 'rake daily:stats'
queue %[echo "-----> Migrating database"]
execute 'rake db:migrate'
queue %[echo "-----> Populate database with db/seeds.rb"]
execute 'rake db:seed'
end
end
OrientDb::Config.database = 'teste'
OrientDb::Config.user = 'teste'
OrientDb::Config.password = '123mudar'
\ No newline at end of file
require 'yaml'
orientdb_configs = YAML.load_file(Rails.root.join('config').to_s.concat('/orient_db.yml'))
env_config = orientdb_configs.fetch(Rails.env)
OrientDb::Config.host = env_config['host']
OrientDb::Config.database = env_config['database']
OrientDb::Config.user = env_config['username']
OrientDb::Config.password = env_config['password']
\ No newline at end of file
development: &development
host: mecdb2.c3sl.ufpr.br
database: PortalMEC
username: admin
password: admin
test:
host: mecdb2.c3sl.ufpr.br
database: PortalMEC
username: admin
password: admin
production:
host: mecdb2.c3sl.ufpr.br
database: PortalMEC
username: admin
password: <%= ENV['PORTALMEC_ORIENTDB_PASSWORD'] %>
\ No newline at end of file
class OrientDb::Client
@@client = nil
def self.instance
......@@ -7,7 +6,7 @@ class OrientDb::Client
return @@client
end
@@client = Orientdb4r.client
@@client = Orientdb4r.client :host => OrientDb::Config::host, :port => OrientDb::Config::port, :ssl => OrientDb::Config::ssl
@@client.connect(database: OrientDb::Config::database, user: OrientDb::Config::user, password: OrientDb::Config::password)
end
......
module OrientDb::Config
@@ssl = false
@@port = 2480
def self.database
@@database
......@@ -24,4 +26,28 @@ module OrientDb::Config
@@password = password
end
def self.host=(host)
@@host = host
end
def self.port=(port)
@@port = port
end
def self.ssl=(ssl)
@@ssl = ssl
end
def self.host
@@host
end
def self.port
@@port || 2480
end
def self.ssl
@@ssl || false
end
end
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment