sinatra

How to filter sensitive information when logging with Sinatra and Rack Logger

余生长醉 提交于 2020-07-30 05:52:20
问题 I maintain a Sinatra app that acts as a JSON API service. The API is consumed by another web app, as well as a mobile app. I'd like to have Rack::CommonLogger exclude sensitive information, like a password, from its logs. Rails has this setting enabled, but I have found no documentation how to do this in Sinatra. 回答1: You can try to intercept the call to write and filter out sensitive messages like so : logger = Logger.new("my_common.log") logger.instance_eval do def write(msg) self.send(:<<,

MongoDB server doesn't start at gitlab runner using gitlab-ci

喜你入骨 提交于 2020-05-28 07:46:28
问题 right now I'm in the middle at developing an application using Ruby and Mongo. But I got stuck when I deploy the application using gitlab-ci where it seems that mongo server doesn't start at test environment on gitlab runner. Here are my gitlab-ci.yml stages : - test - deploy services: - mongo:latest unitTest:API: image: ruby:2.6.10 stage: test cache: paths: - API/vendor/ before_script: - ruby -v - gem install bundler --no-ri --no-rdoc - bundle install --gemfile=API/Gemfile --path vendor

MongoDB server doesn't start at gitlab runner using gitlab-ci

妖精的绣舞 提交于 2020-05-28 07:43:18
问题 right now I'm in the middle at developing an application using Ruby and Mongo. But I got stuck when I deploy the application using gitlab-ci where it seems that mongo server doesn't start at test environment on gitlab runner. Here are my gitlab-ci.yml stages : - test - deploy services: - mongo:latest unitTest:API: image: ruby:2.6.10 stage: test cache: paths: - API/vendor/ before_script: - ruby -v - gem install bundler --no-ri --no-rdoc - bundle install --gemfile=API/Gemfile --path vendor

rake db:migrate not working when using ActiveRecord with Sinatra

倖福魔咒の 提交于 2020-03-04 21:40:09
问题 I am trying to create a very basic Sinatra app which uses only Active Record and Sqlite3. To be as complete as possible I am following instructions from a tutorial which states the following steps in order: Create a database by putting the following code in the main app file: ActiveRecord::Base.establish_connection( :adapter =>'sqlite3', :database=>'wiki.db' ) class User < ActiveRecord::Base validates :username, presence: true, uniqueness: true validates :password, presence: true end To

Is this concept of Oauth2 workflow for sinatra + angular.js + custom provider correct?

眉间皱痕 提交于 2020-02-29 00:01:20
问题 I want to build three example apps. One will be a sinatra oauth2 provider and second will be rails app with angular.js on frontend and rails on backend and third with sinatra on backend and angular.js on frontend. Our Rails/Sinatra app will be authenticate users using satelizer and our custom provider. These is our Oauth2 workflow right now. Using Satellizer we get the authorization code from provider. We send this code to our backend. In backend using this authorization code, secret key and

“Error bad URI” when trying to get WEBrick to accept HTTPS

久未见 提交于 2020-02-28 05:18:23
问题 So I've got a simple Sinatra site: # app.rb require 'sinatra' get '/' do 'Hello world!' end And I can set up rack to serve it over HTTP: # config.ru require './app' run Sinatra::Application # vim: ft=ruby And it works fine when I browse to http://localhost:9292 : % rackup [2013-01-22 10:27:52] INFO WEBrick 1.3.1 [2013-01-22 10:27:52] INFO ruby 1.9.2 (2011-02-18) [x86_64-darwin10.7.4] [2013-01-22 10:27:52] INFO WEBrick::HTTPServer#start: pid=7525 port=9292 127.0.0.1 - - [22/Jan/2013 10:28:05]

Architecture for a modular, component-based Sinatra Application

為{幸葍}努か 提交于 2020-02-17 13:31:56
问题 I'm working on a Sinatra app that contains about 10 different components of functionality. We'd like to be able to mix and match these components into separate instances of the application, configured entirely from a config.yaml file that looks something like: components: - route: '/chunky' component_type: FoodLister component_settings: food_type: bacon max_items: 400 - route: 'places/paris' component_type: Mapper component_settings: latitude: 48.85387273165654 longitude: 2.340087890625 -

Architecture for a modular, component-based Sinatra Application

那年仲夏 提交于 2020-02-17 13:31:56
问题 I'm working on a Sinatra app that contains about 10 different components of functionality. We'd like to be able to mix and match these components into separate instances of the application, configured entirely from a config.yaml file that looks something like: components: - route: '/chunky' component_type: FoodLister component_settings: food_type: bacon max_items: 400 - route: 'places/paris' component_type: Mapper component_settings: latitude: 48.85387273165654 longitude: 2.340087890625 -

Architecture for a modular, component-based Sinatra Application

落花浮王杯 提交于 2020-02-17 13:31:29
问题 I'm working on a Sinatra app that contains about 10 different components of functionality. We'd like to be able to mix and match these components into separate instances of the application, configured entirely from a config.yaml file that looks something like: components: - route: '/chunky' component_type: FoodLister component_settings: food_type: bacon max_items: 400 - route: 'places/paris' component_type: Mapper component_settings: latitude: 48.85387273165654 longitude: 2.340087890625 -