+3
-12
app/config.rb
+3
-12
app/config.rb
···
3
require 'blue_factory'
4
require 'sinatra/activerecord'
5
6
ActiveRecord::Base.connection.execute "PRAGMA journal_mode = WAL"
7
8
BlueFactory.set :publisher_did, 'did:plc:<your_identifier_here>'
···
12
BlueFactory.add_feed 'linux', LinuxFeed.new
13
BlueFactory.add_feed 'starwars', StarWarsFeed.new
14
15
-
# do any additional config & customization on BlueFactory::Server here:
16
-
#
17
-
# BlueFactory::Server.disable :logging
18
-
# BlueFactory::Server.set :port, 4000
19
-
#
20
-
# BlueFactory::Server.get '/' do
21
-
# redirect 'https://web.example.com'
22
-
# end
23
-
#
24
-
# BlueFactory::Server.before do
25
-
# headers "X-Powered-By" => "BlueFactory/#{BlueFactory::VERSION}"
26
-
# end
···
3
require 'blue_factory'
4
require 'sinatra/activerecord'
5
6
+
require_relative 'server'
7
+
8
ActiveRecord::Base.connection.execute "PRAGMA journal_mode = WAL"
9
10
BlueFactory.set :publisher_did, 'did:plc:<your_identifier_here>'
···
14
BlueFactory.add_feed 'linux', LinuxFeed.new
15
BlueFactory.add_feed 'starwars', StarWarsFeed.new
16
17
+
Server.configure
+26
app/server.rb
+26
app/server.rb
···
···
1
+
require 'blue_factory'
2
+
3
+
module Server
4
+
def self.configure
5
+
self.instance_method(:run).bind_call(BlueFactory::Server)
6
+
end
7
+
8
+
def run
9
+
# do any additional config & customization on BlueFactory::Server here
10
+
# see Sinatra docs for more info: https://sinatrarb.com/intro.html
11
+
# e.g.:
12
+
#
13
+
# disable :logging
14
+
# enable :static
15
+
# set :views, File.expand_path('views', __dir__)
16
+
# set :default_encoding, 'cp1250'
17
+
#
18
+
# before do
19
+
# headers "X-Powered-By" => "BlueFactory/#{BlueFactory::VERSION}"
20
+
# end
21
+
#
22
+
# get '/' do
23
+
# erb :index
24
+
# end
25
+
end
26
+
end
+3
config.ru
+3
config.ru
···
1
require_relative 'app/config'
2
3
# might not be needed depending on the app server you use - comment out these lines to leave logs on STDOUT
4
Dir.mkdir('log') unless Dir.exist?('log')
···
9
10
# Sinatra turns off its own logging to stdout if another logger is in the stack
11
use Rack::CommonLogger, $sinatra_log
12
13
run BlueFactory::Server
···
1
require_relative 'app/config'
2
+
require_relative 'app/server'
3
4
# might not be needed depending on the app server you use - comment out these lines to leave logs on STDOUT
5
Dir.mkdir('log') unless Dir.exist?('log')
···
10
11
# Sinatra turns off its own logging to stdout if another logger is in the stack
12
use Rack::CommonLogger, $sinatra_log
13
+
14
+
Server.configure
15
16
run BlueFactory::Server
+3
server.rb
+3
server.rb