docs: document config/ and some directories in app/.
* Add README files to several directories in app/ giving a brief overview of some parts of Danbooru's architecture. * Add documentation for files in config/.
This commit is contained in:
14
config/README.md
Normal file
14
config/README.md
Normal file
@@ -0,0 +1,14 @@
|
||||
# Config
|
||||
|
||||
This directory contains configuration files for Danbooru.
|
||||
|
||||
To configure your Danbooru instance, copy [danbooru_default_config.rb](./danbooru_default_config.rb)
|
||||
to [danbooru_local_config.rb](./danbooru_local_config.rb) and edit it. See
|
||||
[danbooru_default_config.rb](./danbooru_default_config.rb) for details.
|
||||
|
||||
The only file here that end users need to be concerned about is [danbooru_default_config.rb](./danbooru_default_config.rb).
|
||||
The rest of the files here are internal Rails-related configuration files that end users shouldn't need to edit.
|
||||
|
||||
# External links
|
||||
|
||||
* https://guides.rubyonrails.org/configuring.html
|
||||
@@ -1,4 +1,10 @@
|
||||
# This file runs after config/boot.rb and before config/environment.rb. It loads Rails, loads the gems, loads the
|
||||
# Danbooru configuration, and does some basic Rails configuration.
|
||||
#
|
||||
# @see https://guides.rubyonrails.org/initialization.html
|
||||
|
||||
require_relative 'boot'
|
||||
|
||||
require "rails"
|
||||
require "active_record/railtie"
|
||||
# require "active_storage/engine"
|
||||
@@ -12,8 +18,11 @@ require "active_job/railtie"
|
||||
require "rails/test_unit/railtie"
|
||||
# require "sprockets/railtie"
|
||||
|
||||
# Load the gems for the current Rails environment from the Gemfile.
|
||||
Bundler.require(*Rails.groups)
|
||||
|
||||
# Load the default Danbooru configuration from config/danbooru_default_config.rb and the custom config from
|
||||
# config/danbooru_local_config.rb.
|
||||
begin
|
||||
require_relative "danbooru_default_config"
|
||||
require_relative ENV.fetch("DANBOORU_CONFIG_FILE", "danbooru_local_config")
|
||||
|
||||
@@ -1,4 +1,14 @@
|
||||
# This is the first file that runs during Rails boot. The next files to run are
|
||||
# config/application.rb, then config/environment.rb.
|
||||
#
|
||||
# @see https://guides.rubyonrails.org/initialization.html
|
||||
# @see https://github.com/Shopify/bootsnap
|
||||
|
||||
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
|
||||
|
||||
require "bundler/setup" # Set up gems listed in the Gemfile.
|
||||
require "bootsnap/setup" # Speed up boot time by caching expensive operations.
|
||||
# Set up the load path for gems listed in the Gemfile. Does not actually load the gems; that happens in
|
||||
# config/application.rb.
|
||||
require "bundler/setup"
|
||||
|
||||
# Speed up boot time by caching expensive operations.
|
||||
require "bootsnap/setup"
|
||||
@@ -1,3 +1,26 @@
|
||||
# This file contains all the configuration settings for Danbooru.
|
||||
#
|
||||
# Don't edit this file. Instead, to configure your Danbooru instance, copy this
|
||||
# file to config/danbooru_local_config.rb and edit that. Remove all settings you
|
||||
# don't need to change, and edit only the settings you do need to change.
|
||||
#
|
||||
# You can also use environment variables to change settings on the command line.
|
||||
# For example, to change the site name, you could do:
|
||||
#
|
||||
# DANBOORU_APP_NAME=MyBooru bin/rails server
|
||||
#
|
||||
# This works with nearly any setting. Just take the setting name, uppercase it,
|
||||
# and add DANBOORU_ to the front. More examples:
|
||||
#
|
||||
# DANBOORU_CANONICAL_URL=https://booru.example.com
|
||||
# DANBOORU_CONTACT_EMAIL=admin@borou.example.com
|
||||
# DANBOORU_DISCORD_SERVER_URL=https://discord.gg/yourbooru
|
||||
#
|
||||
# Settings from environment variables will override those from the config file.
|
||||
#
|
||||
# You can also set these environment variables in an envfile instead of the
|
||||
# command line. See the .env file in the root project directory for details.
|
||||
#
|
||||
module Danbooru
|
||||
class Configuration
|
||||
# A secret key used to encrypt session cookies, among other things.
|
||||
|
||||
@@ -1,9 +1,28 @@
|
||||
# Don't edit this file. To override this file, set `DATABASE_URL` in .env.local
|
||||
# instead. Example:
|
||||
# This file contains database configuration. Don't edit this file. To override
|
||||
# this file, set `DATABASE_URL` in .env.local instead.
|
||||
#
|
||||
# DATABASE_URL=postgresql://danbooru:password@localhost/danbooru2
|
||||
# By default, with no configuration, we try to connect to the Postgres server
|
||||
# running on localhost with username `danbooru` and database name `danbooru2`.
|
||||
#
|
||||
# https://guides.rubyonrails.org/configuring.html#configuring-a-database
|
||||
# Example:
|
||||
#
|
||||
# # Connect to the database named `danbooru2` via localhost on port 5432
|
||||
# DATABASE_URL=postgresql://localhost/danbooru2
|
||||
#
|
||||
# # Connect via Unix domain socket in /var/run/postgresql
|
||||
# # https://zaiste.net/posts/postgresql-unix-socket-tcpip-loopback/
|
||||
# DATABASE_URL=postgresql://%2Fvar%2Frun%2Fpostgresql/danbooru2
|
||||
#
|
||||
# The general form for a database URL is:
|
||||
#
|
||||
# postgresql://[user[:password]@][host][:port][/dbname][?param1=value1&...]`
|
||||
#
|
||||
# The default is:
|
||||
#
|
||||
# postgresql://danbooru@localhost/danbooru2
|
||||
#
|
||||
# @see https://guides.rubyonrails.org/configuring.html#configuring-a-database
|
||||
# @see https://www.postgresql.org/docs/current/libpq-connect.html#id-1.7.3.8.3.6
|
||||
|
||||
default: &default
|
||||
adapter: postgresql
|
||||
|
||||
@@ -1,3 +1,12 @@
|
||||
# This file contains configuration settings for deploying Danbooru to the
|
||||
# production servers using Capistrano. This is only used by production and
|
||||
# shouldn't be edited by end users.
|
||||
#
|
||||
# @see Capfile
|
||||
# @see config/deploy
|
||||
# @see lib/capistrano/tasks
|
||||
# @see https://capistranorb.com
|
||||
|
||||
set :stages, %w(production development staging)
|
||||
set :default_stage, "staging"
|
||||
set :application, "danbooru"
|
||||
|
||||
14
config/deploy/README.md
Normal file
14
config/deploy/README.md
Normal file
@@ -0,0 +1,14 @@
|
||||
# Deploy
|
||||
|
||||
This directory contains configuration settings for deploying Danbooru to the production servers
|
||||
using Capistrano. This is only used by production and shouldn't be edited by end users.
|
||||
|
||||
# See also
|
||||
|
||||
* [Capfile](../../Capfile)
|
||||
* [config/deploy.rb](../deploy.rb)
|
||||
* [lib/capistrano/tasks](../../lib/capistrano/tasks)
|
||||
|
||||
# External links
|
||||
|
||||
* https://capistranorb.com
|
||||
10
config/docker/README.md
Normal file
10
config/docker/README.md
Normal file
@@ -0,0 +1,10 @@
|
||||
# Docker
|
||||
|
||||
This directory contains files for building Docker images for Danbooru.
|
||||
|
||||
# External links
|
||||
|
||||
* https://docs.docker.com/get-started/
|
||||
* https://docs.docker.com/engine/reference/commandline/cli/
|
||||
* https://docs.docker.com/engine/reference/builder/
|
||||
* https://hub.docker.com/r/evazion/danbooru
|
||||
15
config/environments/README.md
Normal file
15
config/environments/README.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# Environments
|
||||
|
||||
This directory contains environment-specific Rails configuration. This lets us have different
|
||||
configuration settings in development, test, and production modes.
|
||||
|
||||
Universal Rails configuration goes in [config/application.rb](../application.rb) or in
|
||||
[config/initializers](../initializers).
|
||||
|
||||
# See also
|
||||
|
||||
* [config/application.rb](../application.rb)
|
||||
|
||||
# External links
|
||||
|
||||
* https://guides.rubyonrails.org/configuring.html#creating-rails-environments
|
||||
15
config/initializers/README.md
Normal file
15
config/initializers/README.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# Initializers
|
||||
|
||||
This directory contains initializers run by Rails during bootup. Initializers are generally used to
|
||||
configure libraries or other global settings during application boot.
|
||||
|
||||
# See also
|
||||
|
||||
* [config/boot.rb](../boot.rb)
|
||||
* [config/application.rb](../application.rb)
|
||||
* [config/environment.rb](../environment.rb)
|
||||
|
||||
# External links
|
||||
|
||||
* https://guides.rubyonrails.org/configuring.html#using-initializer-files
|
||||
* https://guides.rubyonrails.org/initialization.html
|
||||
@@ -1,3 +1,10 @@
|
||||
# This file contains configuration settings for the Puma web server. These
|
||||
# settings apply when running Danbooru with `bin/rails server`. In production,
|
||||
# Danbooru currently uses Unicorn instead of Puma.
|
||||
#
|
||||
# @see https://puma.io
|
||||
# @see https://github.com/puma/puma
|
||||
|
||||
# Puma can serve each request in a thread from an internal thread pool.
|
||||
# The `threads` method setting takes two numbers: a minimum and maximum.
|
||||
# Any libraries that use thread pools should be configured to match
|
||||
|
||||
@@ -1,3 +1,12 @@
|
||||
# This file contains configuration for Danbooru's URL routes. It defines all the
|
||||
# URL endpoints and HTTP redirects used by Danbooru.
|
||||
#
|
||||
# A list of routes can be found at http://localhost:3000/rails/info/routes when
|
||||
# running the server in development mode. You can also run `bin/rails routes` to
|
||||
# produce a list of routes.
|
||||
#
|
||||
# @see https://guides.rubyonrails.org/routing.html
|
||||
# @see http://localhost:3000/rails/info/routes
|
||||
Rails.application.routes.draw do
|
||||
resources :posts, only: [:index, :show, :update, :destroy] do
|
||||
get :random, on: :collection
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
# This file is used by the `whenver` gem to generate a crontab that runs
|
||||
# Danbooru's maintenance tasks.
|
||||
#
|
||||
# @see app/logical/danbooru_maintenance.rb
|
||||
# @see https://github.com/javan/whenever
|
||||
|
||||
# this is used in config/environments/production.rb.
|
||||
env "RAILS_LOG_TO_STDOUT", "true"
|
||||
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
# https://solargraph.org/guides/rails
|
||||
# https://gist.github.com/castwide/28b349566a223dfb439a337aea29713e
|
||||
# This file is used by the Solargraph language server to add better knowledge of
|
||||
# Rails for intellisense purposes for editors like VS Code or Vim that have Ruby
|
||||
# language server support configured.
|
||||
#
|
||||
# @see https://solargraph.org/guides/rails
|
||||
# @see https://gist.github.com/castwide/28b349566a223dfb439a337aea29713e
|
||||
#
|
||||
# The following comments fill some of the gaps in Solargraph's understanding of
|
||||
# Rails apps. Since they're all in YARD, they get mapped in Solargraph but
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
# This file configures Spring, the Rails application preloader.
|
||||
#
|
||||
# @see https://github.com/rails/spring
|
||||
|
||||
%w[
|
||||
.ruby-version
|
||||
.rbenv-vars
|
||||
|
||||
12
config/unicorn/README.md
Normal file
12
config/unicorn/README.md
Normal file
@@ -0,0 +1,12 @@
|
||||
# Unicorn
|
||||
|
||||
This directory contains configuration files for Unicorn, the web server that Danbooru uses in production.
|
||||
|
||||
# See also
|
||||
|
||||
* [config/puma.rb](../puma.rb)
|
||||
|
||||
# External links
|
||||
|
||||
* https://yhbt.net/unicorn/README.html
|
||||
* https://github.com/defunkt/unicorn
|
||||
16
config/webpack/README.md
Normal file
16
config/webpack/README.md
Normal file
@@ -0,0 +1,16 @@
|
||||
# Webpack
|
||||
|
||||
This directory contains configuration for Webpack. Webpack is used to bundle Javascript and CSS
|
||||
assets in production. In Rails, Webpack is wrapped by Webpacker, a layer that tries to provide
|
||||
sensible defaults for Webpack.
|
||||
|
||||
# See also
|
||||
|
||||
* [app/javascript](../../app/javascript)
|
||||
* [config/webpacker.yml](../webpacker.yml)
|
||||
|
||||
# External links
|
||||
|
||||
* https://guides.rubyonrails.org/webpacker.html
|
||||
* https://github.com/rails/webpacker#webpack-configuration
|
||||
* https://webpack.js.org/configuration/
|
||||
@@ -13,6 +13,7 @@ module.exports = merge(webpackConfig, {
|
||||
},
|
||||
module: {
|
||||
rules: [{
|
||||
// https://github.com/usabilityhub/rails-erb-loader
|
||||
test: /.erb$/,
|
||||
enforce: "pre",
|
||||
exclude: /node_modules/,
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// @see https://github.com/webpack-contrib/eslint-webpack-plugin
|
||||
|
||||
process.env.NODE_ENV = process.env.NODE_ENV || 'development'
|
||||
|
||||
const { merge } = require('@rails/webpacker')
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
# This file configures Webpacker, the Rails wrapper around Webpack. Webpack is
|
||||
# used to bundle Javascript and CSS assets.
|
||||
#
|
||||
# Note: You must restart bin/webpack-dev-server for changes to take effect
|
||||
#
|
||||
# @see https://github.com/rails/webpacker
|
||||
# @see https://edgeguides.rubyonrails.org/webpacker.html
|
||||
|
||||
default: &default
|
||||
source_path: app/javascript
|
||||
|
||||
Reference in New Issue
Block a user