### Initial Project Setup Source: https://github.com/sebadob/rauthy/blob/main/CONTRIBUTING.md Installs frontend dependencies using npm and prepares the project for building or development. Run this once or after a version bump. ```bash just setup ``` -------------------------------- ### TOML Configuration Example Source: https://github.com/sebadob/rauthy/blob/main/book/src/config/encryption.md Example TOML configuration showing multiple encryption keys and how to set the active key. ```toml [encryption] key = [ "Wx1zrbLF/5vTaB7LdUSg1aTecmqHJOu2+RnU6zgTwNkDQU52Y3JM=", "6uf5QebA/9DsKMoq8A+Gn2WQrTcSpz5sg751yYs3IJlkw3dn0rII=" ] ``` ```toml [encryption] key_active = "Wx1zrbLF" ``` -------------------------------- ### Start Development Environment Source: https://github.com/sebadob/rauthy/blob/main/CONTRIBUTING.md Starts the Mailcrab and Postgres development containers. Errors can be ignored if containers are already running. Use 'just mailcrab-start' if Postgres is not needed. ```bash just dev-env-start ``` -------------------------------- ### Run Rauthy with Hiqlite Backend Source: https://github.com/sebadob/rauthy/blob/main/CONTRIBUTING.md This command starts Rauthy with a Hiqlite backend and serves the UI on port 8080. It's the default setup for local development. ```bash just run ``` -------------------------------- ### Install Documentation Tools Source: https://github.com/sebadob/rauthy/blob/main/CONTRIBUTING.md Install mdbook and mdbook-admonish using cargo to update the Rauthy book. Ensure you use mdbook version 0.4.x due to compatibility issues. ```bash cargo install mdbook --version 0.4.52 ``` ```bash cargo install mdbook-admonish ``` -------------------------------- ### Serve Rauthy with Generated Configuration Source: https://github.com/sebadob/rauthy/blob/main/book/src/getting_started/docker.md Starts the Rauthy server using the generated configuration file. Ensure TLS certificates are in place if configured. ```bash rauthy serve -c data/config-generated.toml ``` -------------------------------- ### Minimal Production TOML Configuration for Rauthy Source: https://github.com/sebadob/rauthy/blob/main/docs/config/config_minimal.html This TOML configuration provides a starting point for a minimal production setup. Adjust values as needed for your specific environment. Note that environment variables can override these settings. ```toml [bootstrap] # If set, the email of the default admin will be changed during # the initialization of an empty production database. # # default: 'admin@localhost' # overwritten by: BOOTSTRAP_ADMIN_EMAIL admin_email = "admin@localhost" [cluster] # Can be set to 'k8s' to try to split off the node id from the hostname # when Hiqlite is running as a StatefulSet inside Kubernetes. # # default: unset # overwritten by: HQL_NODE_ID_FROM #node_id_from = "k8s" # The node id must exist in the nodes and there must always be # at least a node with ID 1 # Will be ignored if `node_id_from = k8s` # # At least `node_id_from` or `node_id` are required. # # default: 0 (invalid) # overwritten by: HQL_NODE_ID node_id = 1 # All cluster member nodes. For a single instance deployment, # "1 localhost:8100 localhost:8200" will work just fine. # Each array value must have the following format: # `id addr_raft addr_api` # # default: ["1 localhost:8100 localhost:8200"] # overwritten by: HQL_NODES nodes = [ "1 localhost:8100 localhost:8201", # "2 localhost:8101 localhost:8201", # "3 localhost:8102 localhost:8202", ] # Secrets for Raft internal authentication as well as for the API. # These must be at least 16 characters long and you should provide # different ones for both variables. # # default: not set - required # overwritten by: HQL_SECRET_RAFT secret_raft = "SuperSecureSecret1337" # default: not set - required # overwritten by: HQL_SECRET_API secret_api = "SuperSecureSecret1337" [email] # Rauthy will force TLS and try a downgrade to STARTTLS, if # TLS fails. It will never allow an unencrypted connection. # You might want to set `SMTP_DANGER_INSECURE=true` if you # need this for local dev. # # overwritten by: SMTP_URL smtp_url = "localhost" # optional, default will be used depending on TLS / STARTTLS # overwritten by: SMTP_PORT #smtp_port = # overwritten by: SMTP_USERNAME smtp_username = "username" # overwritten by: SMTP_PASSWORD smtp_password = "password" # Format: "Rauthy " # default: "Rauthy " # overwritten by: SMTP_FROM smtp_from = "Rauthy " [encryption] # You need to define at least one valid encryption key. # These keys are used in various places, like for instance ``` -------------------------------- ### Example Encryption Key Configuration Source: https://github.com/sebadob/rauthy/blob/main/book/src/getting_started/k8s.md Shows how to format the generated encryption keys within the Rauthy TOML configuration file. ```toml [encryption] keys = ["XLCcaQ/f2xmq/nxVFgJN0CN311miyvVlBxXOQISyw1nPEPOqiI="] key_active = "XLCcaQ" ``` -------------------------------- ### Minimal Production Configuration Example Source: https://github.com/sebadob/rauthy/blob/main/docs/print.html This TOML snippet shows a minimal configuration for a production environment. Adjust values as needed and refer to the full reference configuration for more options. ```toml [bootstrap] # If set, the email of the default admin will be changed during # the initialization of an empty production database. # # default: 'admin@localhost' # overwritten by: BOOTSTRAP_ADMIN_EMAIL admin_email = "admin@localhost" ``` -------------------------------- ### Example Rauthy Encryption Configuration Source: https://github.com/sebadob/rauthy/blob/main/docs/print.html Illustrates how to configure encryption keys in Rauthy's settings, including multiple keys and specifying the active key. ```ini [encryption] keys = ["Wx1zrbLF/5vTaB7LdUSg1aTecmqHJOu2+RnU6zgTwNkDQU52Y3JM=", "6uf5QebA/9DsKMoq8A+Gn2WQrTcSpz5sg751yYs3IJlkw3dn0rII=", ] key_active = "Wx1zrbLF" ``` -------------------------------- ### Run Rauthy with Postgres Backend Source: https://github.com/sebadob/rauthy/blob/main/CONTRIBUTING.md Use this command to start Rauthy with a Postgres backend instead of the default Hiqlite. ```bash just run postgres ``` -------------------------------- ### Bootstrap API Key Example Source: https://github.com/sebadob/rauthy/blob/main/docs/config/config.html Provides an example of a base64 encoded JSON structure for creating a bootstrap API key. This key is used for initial database bootstrapping and requires specific formatting for name, expiration, and access rights. ```json ewogICJuYW1lIjogImJvb3RzdHJhcCIsCiAgImV4cCI6IDE3MzU1OTk2MDAsCiAgImFjY2VzcyI6IFsKICAgIHsKICAgICAgImdyb3VwIjogIkNsaWVudHMiLAogICAgICAiYWNjZXNzX3JpZ2h0cyI6IFsKICAgICAgICAicmVhZCIsCiAgICAgICAgImNyZWF0ZSIsCiAgICAgICAgInVwZGF0ZSIsCiAgICAgICAgImRlbGV0ZSIKICAgICAgXQogICAgfSwKICAgIHsKICAgICAgImdyb3VwIjogIlJvbGVzIiwKICAgICAgImFjY2Vzc19yaWdodHMiOiBbCiAgICAgICAgInJlYWQiLAogICAgICAgICJjcmVhdGUiLAogICAgICAgICJ1cGRhdGUiLAogICAgICAgICJkZWxldGUiCiAgICAgIF0KICAgIH0sCiAgICB7CiAgICAgICJncm91cCI6ICJHcm91cHMiLAogICAgICAiYWNjZXNzX3JpZ2h0cyI6IFsKICAgICAgICAicmVhZCIsCiAgICAgICAgImNyZWF0ZSIsCiAgICAgICAgInVwZGF0ZSIsCiAgICAgICAgImRlbGV0ZSIKICAgICAgXQogICAgfQogIF0KfQ== ``` -------------------------------- ### Start Docker Compose Source: https://github.com/sebadob/rauthy/blob/main/docs/print.html Command to start the services defined in the docker-compose.yaml file in detached mode. ```bash docker compose up -d ``` -------------------------------- ### Start Docker Compose Services Source: https://github.com/sebadob/rauthy/blob/main/book/src/getting_started/docker.md Launches the services defined in the docker-compose.yaml file in detached mode. ```bash docker compose up -d ``` -------------------------------- ### Configure Rauthy Start Event Level Source: https://github.com/sebadob/rauthy/blob/main/book/src/config/logging.md Sets the event level for Rauthy instance startup to 'info'. This configuration is overwritten by the EVENT_LEVEL_RAUTHY_START environment variable. ```toml # The level for the generated Event after a Rauthy # instance has been started # # default: info # overwritten by: EVENT_LEVEL_RAUTHY_START level_rauthy_start = 'info' ``` -------------------------------- ### Run Rauthy for Local Testing Source: https://github.com/sebadob/rauthy/blob/main/docs/print.html Use this command to quickly start Rauthy for local evaluation. It uses a basic, insecure default configuration and is only suitable for localhost testing. ```bash docker run -it --rm -e LOCAL_TEST=true -p 8443:8443 ghcr.io/sebadob/rauthy:0.35.2 ``` -------------------------------- ### Enable Swagger UI Source: https://github.com/sebadob/rauthy/blob/main/docs/print.html Enable the Swagger UI to access API documentation. This consumes approximately 13MB of additional memory and is initialized at application start if enabled. ```toml [server] # Can be set to `true` to enable the Swagger UI. # This will consume ~13mb of additional memory. # # default: false # overwritten by: SWAGGER_UI_ENABLE swagger_ui_enable = false ``` -------------------------------- ### Minimal Production TOML Configuration for Rauthy Source: https://github.com/sebadob/rauthy/blob/main/book/src/config/config_minimal.md This TOML configuration provides the most basic setup for a production environment. Adjust values as needed and refer to the complete reference configuration for more options. ```toml [bootstrap] # If set, the email of the default admin will be changed during # the initialization of an empty production database. # # default: 'admin@localhost' # overwritten by: BOOTSTRAP_ADMIN_EMAIL admin_email = "admin@localhost" [cluster] # Can be set to 'k8s' to try to split off the node id from the hostname # when Hiqlite is running as a StatefulSet inside Kubernetes. # # default: unset # overwritten by: HQL_NODE_ID_FROM #node_id_from = "k8s" # The node id must exist in the nodes and there must always be # at least a node with ID 1 # Will be ignored if `node_id_from = k8s` # # At least `node_id_from` or `node_id` are required. # # default: 0 (invalid) # overwritten by: HQL_NODE_ID node_id = 1 # All cluster member nodes. For a single instance deployment, # "1 localhost:8100 localhost:8200" will work just fine. # Each array value must have the following format: # `id addr_raft addr_api` # # default: ["1 localhost:8100 localhost:8200"] # overwritten by: HQL_NODES nodes = [ "1 localhost:8100 localhost:8200", # "2 localhost:8101 localhost:8201", # "3 localhost:8102 localhost:8202", ] # Secrets for Raft internal authentication as well as for the API. # These must be at least 16 characters long and you should provide # different ones for both variables. # # default: not set - required # overwritten by: HQL_SECRET_RAFT secret_raft = "SuperSecureSecret1337" # default: not set - required # overwritten by: HQL_SECRET_API secret_api = "SuperSecureSecret1337" [email] # Rauthy will force TLS and try a downgrade to STARTTLS, if # TLS fails. It will never allow an unencrypted connection. # You might want to set `SMTP_DANGER_INSECURE=true` if you # need this for local dev. # # overwritten by: SMTP_URL smtp_url = "localhost" # optional, default will be used depending on TLS / STARTTLS # overwritten by: SMTP_PORT #smtp_port = # overwritten by: SMTP_USERNAME smtp_username = "username" # overwritten by: SMTP_PASSWORD smtp_password = "password" # Format: "Rauthy " # default: "Rauthy " # overwritten by: SMTP_FROM smtp_from = "Rauthy " [encryption] # You need to define at least one valid encryption key. # These keys are used in various places, like for instance # encrypting confidential client secrets in the database, or # encryption cookies, and so on. # # The first part until the first `/` is the key ID. # The ID must match '^[a-zA-Z0-9:_-]{2,20}' # # The key itself begins after the first `/` has been found. # The key must be exactly 32 bytes long, encoded as base64. # # You can find a more detailed explanation on how to generate # keys in the documentation: # 1. https://sebadob.github.io/rauthy/getting_started/k8s.html#create-and-apply-secrets # 2. https://sebadob.github.io/rauthy/config/encryption.html # # You can provide multiple keys to make things like key # rotation work. Be careful with removing old keys. Make sure # that all secrets have been migrated beforehand. # You can find a utility in the Admin UI to do this for you. # # overwritten by: ENC_KEYS - single String, \n separated values keys = ["q6u26/M0NFQzhSSldCY01rckJNa1JYZ3g2NUFtSnNOVGdoU0E="] # This identifies the key ID from the `ENC_KEYS` list, that # should actively be used for new encryptions. # # overwritten by: ENC_KEY_ACTIVE key_active = "q6u26" [events] # The E-Mail address event notifications should be sent to. # # overwritten by: EVENT_EMAIL email = "admin@localhost" [server] # The scheme to use locally, valid values: # http | https | http_https | unix_http | unix_https # For more details about the UNIX domain socket, check out its # documentation page. # # default: http_https # overwritten by: LISTEN_SCHEME scheme = "http" # The Public URL of the whole deployment # The LISTEN_SCHEME + PUB_URL must match the HTTP ORIGIN HEADER # later on, which is especially important when running Rauthy # behind a reverse proxy. In case of a non-standard port (80/443), # you need to add the port to the PUB_URL # # default: not set - mandatory # overwritten by: PUB_URL pub_url = "localhost:8080" # When rauthy is running behind a reverse proxy, set to true # # default: false # overwritten by: PROXY_MODE proxy_mode = false # A list of trusted proxy CIDRs. When `proxy_mode = true` # or `peer_ip_header_name` is set, these are mandatory to # be able to extract the real client IP properly and safely # to prevent IP header spoofing. All requests with a # different source will be blocked. # # default: [] # overwritten by: TRUSTED_PROXIES - single String, \n separated values #trusted_proxies = ['192.168.14.0/24'] [webauthn] ``` -------------------------------- ### Rauthy Kubernetes StatefulSet Definition Source: https://github.com/sebadob/rauthy/blob/main/book/src/getting_started/k8s.md Defines the StatefulSet for Rauthy, specifying replica count and service name. It's recommended to start with one replica for initial setup. ```yaml apiVersion: apps/v1 kind: StatefulSet metadata: name: rauthy namespace: rauthy labels: app: rauthy spec: serviceName: rauthy-headless # If you start a fresh cluster without a bootstrapped Admin password, it is # highly suggested to start a single replica for the first setup + login. # It will work with 3 replicas directly, but if you are not quick enough and # your logs buffer size is small, you might miss the auto-generated password # in Pod `rauthy-0` because of many logs. replicas: 1 selector: matchLabels: app: rauthy ``` -------------------------------- ### Example API Key Authentication Header Source: https://github.com/sebadob/rauthy/blob/main/book/src/work/api_keys.md An example of a correctly formatted 'Authorization' header using an API Key. This format is automatically generated by Rauthy. ```http Authorization: API-Key my_key$twUA2M7RZ8H3FyJHbti2AcMADPDCxDqUKbvi8FDnm3nYidwQx57Wfv6iaVTQynMh ``` -------------------------------- ### Authorization Header Example Source: https://github.com/sebadob/rauthy/blob/main/book/src/config/logging.md This is an example of the `Authorization` header format required to authenticate with the Rauthy event stream. The prefix `API-Key` is followed by the generated API key. ```text Authorization: API-Key events$SUcpBxcPmfwH9z1Kb4ExOUYDSXpxOj9mFLadjuQ1049XaWzdWB328aa97k2nj21E ``` -------------------------------- ### Serve and Build Rauthy Documentation Source: https://github.com/sebadob/rauthy/blob/main/CONTRIBUTING.md Commands to serve the documentation locally for development and to build the documentation for deployment. Changes are made to markdown files in the book/src directory. ```bash cd book mdbook serve --open ``` ```bash just build-docs ``` -------------------------------- ### Serve Rauthy Application Source: https://github.com/sebadob/rauthy/blob/main/book/src/config/cli.md This command launches the Rauthy application. Ensure all configurations are set before running this command. ```bash rauthy serve ``` -------------------------------- ### Initialize Theme and Sidebar Settings Source: https://github.com/sebadob/rauthy/blob/main/docs/404.html This script initializes theme and sidebar settings based on local storage and user preferences. It handles theme switching and sidebar visibility for the documentation. ```javascript const path_to_root = ""; const default_light_theme = "light"; const default_dark_theme = "navy"; ``` ```javascript try { let theme = localStorage.getItem('mdbook-theme'); let sidebar = localStorage.getItem('mdbook-sidebar'); if (theme.startsWith('"') && theme.endsWith('"')) { localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1)); } if (sidebar.startsWith('"') && sidebar.endsWith('"')) { localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1)); } } catch (e) { } ``` ```javascript const default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? default_dark_theme : default_light_theme; let theme; try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { } if (theme === null || theme === undefined) { theme = default_theme; } const html = document.documentElement; html.classList.remove('light') html.classList.add(theme); html.classList.add("js"); ``` ```javascript let sidebar = null; const sidebar_toggle = document.getElementById("sidebar-toggle-anchor"); if (document.body.clientWidth >= 1080) { try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { } sidebar = sidebar || 'visible'; } else { sidebar = 'hidden'; } sidebar_toggle.checked = sidebar === 'visible'; html.classList.remove('sidebar-visible'); html.classList.add("sidebar-" + sidebar); ``` -------------------------------- ### Get Specific Bootstrap Secret in Raw Format Source: https://github.com/sebadob/rauthy/blob/main/book/src/config/cli.md Retrieves a single, specific bootstrap-generated secret value in its raw form. Use this to get a single field like a client secret. ```bash rauthy bootstrap get \ --kind client \ --id my-service \ --field secret \ --format raw ``` -------------------------------- ### Initialize Theme and Sidebar Settings Source: https://github.com/sebadob/rauthy/blob/main/docs/swagger.html This JavaScript code initializes theme and sidebar settings for the documentation site, reading from local storage and applying classes to the HTML element. It handles potential errors during local storage access and sets default themes based on user's system preferences. ```javascript const path_to_root = ""; const default_light_theme = "light"; const default_dark_theme = "navy"; try { let theme = localStorage.getItem('mdbook-theme'); let sidebar = localStorage.getItem('mdbook-sidebar'); if (theme.startsWith('"') && theme.endsWith('"')) { localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1)); } if (sidebar.startsWith('"') && sidebar.endsWith('"')) { localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1)); } } catch (e) { } const default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? default_dark_theme : default_light_theme; let theme; try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { } if (theme === null || theme === undefined) { theme = default_theme; } const html = document.documentElement; html.classList.remove('light') html.classList.add(theme); html.classList.add("js"); let sidebar = null; const sidebar_toggle = document.getElementById("sidebar-toggle-anchor"); if (document.body.clientWidth >= 1080) { try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { } sidebar = sidebar || 'visible'; } else { sidebar = 'hidden'; } sidebar_toggle.checked = sidebar === 'visible'; html.classList.remove('sidebar-visible'); html.classList.add("sidebar-" + sidebar); ``` -------------------------------- ### API Key Bootstrap JSON Example Source: https://github.com/sebadob/rauthy/blob/main/docs/print.html An example JSON structure for bootstrapping an API key with specific access rights to groups like Clients, Roles, and Groups. This JSON should be base64 encoded. ```json { "name": "bootstrap", "exp": 1735599600, "access": [ { "group": "Clients", "access_rights": [ "read", "create", "update", "delete" ] }, { "group": "Roles", "access_rights": [ "read", "create", "update", "delete" ] }, { "group": "Groups", "access_rights": [ "read", "create", "update", "delete" ] } ] } ``` -------------------------------- ### Example Rauthy Encryption Configuration Source: https://github.com/sebadob/rauthy/blob/main/book/src/config/encryption.md Example TOML configuration for Rauthy's encryption settings. `keys` is an array of available encryption keys, and `key_active` specifies the currently used key ID. ```toml [encryption] keys = ["90eb6d69/U9wZG4GS/94pVh6iTH1ijf+kj+tXJHKkQNsp5eImMQI="] key_active = "90eb6d69" ``` -------------------------------- ### Run Rauthy with Docker for Local Testing Source: https://github.com/sebadob/rauthy/blob/main/book/src/getting_started/docker.md Starts a Rauthy instance with a basic default configuration suitable for local testing. This configuration is not production-ready and should only be used on localhost due to hardcoded secrets and unsafe settings. ```bash docker run -it --rm -e LOCAL_TEST=true -p 8443:8443 ghcr.io/sebadob/rauthy:0.35.2 ``` -------------------------------- ### Enable Playground Copy Button Source: https://github.com/sebadob/rauthy/blob/main/docs/404.html Enables the copy-to-clipboard functionality for code examples within the playground. ```javascript window.playground_copyable = true; ``` -------------------------------- ### Build UI Source: https://github.com/sebadob/rauthy/blob/main/CONTRIBUTING.md Builds the static UI files for Rauthy. This command may need to be re-run after encountering templating errors from askama. ```bash just build-ui ``` -------------------------------- ### Initialize Theme and Sidebar Settings Source: https://github.com/sebadob/rauthy/blob/main/docs/work/jwks.html This script initializes theme and sidebar settings based on local storage and user preferences. It ensures compatibility with older local storage entries and applies the correct theme and sidebar visibility. ```javascript const path_to_root = "../"; const default_light_theme = "light"; const default_dark_theme = "navy"; try { let theme = localStorage.getItem('mdbook-theme'); let sidebar = localStorage.getItem('mdbook-sidebar'); if (theme.startsWith('"') && theme.endsWith('"')) { localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1)); } if (sidebar.startsWith('"') && sidebar.endsWith('"')) { localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1)); } } catch (e) { } const default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? default_dark_theme : default_light_theme; let theme; try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { } if (theme === null || theme === undefined) { theme = default_theme; } const html = document.documentElement; html.classList.remove('light') html.classList.add(theme); html.classList.add("js"); let sidebar = null; const sidebar_toggle = document.getElementById("sidebar-toggle-anchor"); if (document.body.clientWidth >= 1080) { try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { } sidebar = sidebar || 'visible'; } else { sidebar = 'hidden'; } sidebar_toggle.checked = sidebar === 'visible'; html.classList.remove('sidebar-visible'); html.classList.add("sidebar-" + sidebar); ``` -------------------------------- ### Create Rauthy Data and TLS Directories Source: https://github.com/sebadob/rauthy/blob/main/book/src/getting_started/docker.md Initializes the necessary directories for Rauthy's persistent data and TLS certificates. ```bash mkdir -p rauthy/data rauthy/tls ``` -------------------------------- ### Authorization Header Format Source: https://github.com/sebadob/rauthy/blob/main/docs/config/bootstrap.html Example of how to construct the Authorization header using the bootstrap API key name and its secret, separated by a '$'. ```http Authorization: API-Key bootstrap$twUA2M7RZ8H3FyJHbti2AcMADPDCxDqUKbvi8FDnm3nYidwQx57Wfv6iaVTQynMh ``` -------------------------------- ### Initialize Theme and Sidebar - JavaScript Source: https://github.com/sebadob/rauthy/blob/main/docs/config/sessions.html Initializes the theme and sidebar visibility based on local storage and user preferences. Handles potential errors during local storage access. ```javascript try { let theme = localStorage.getItem('mdbook-theme'); let sidebar = localStorage.getItem('mdbook-sidebar'); if (theme.startsWith('"') && theme.endsWith('"')) { localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1)); } if (sidebar.startsWith('"') && sidebar.endsWith('"')) { localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1)); } } catch (e) { } ``` ```javascript const default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? default_dark_theme : default_light_theme; let theme; try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { } if (theme === null || theme === undefined) { theme = default_theme; } const html = document.documentElement; html.classList.remove('light') html.classList.add(theme); html.classList.add("js"); ``` ```javascript let sidebar = null; const sidebar_toggle = document.getElementById("sidebar-toggle-anchor"); if (document.body.clientWidth >= 1080) { try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { } sidebar = sidebar || 'visible'; } else { sidebar = 'hidden'; } sidebar_toggle.checked = sidebar === 'visible'; html.classList.remove('sidebar-visible'); html.classList.add("sidebar-" + sidebar); ``` -------------------------------- ### View Rauthy Logs Source: https://github.com/sebadob/rauthy/blob/main/docs/print.html Follow the logs of the Rauthy service to retrieve the randomly generated password for the admin account when using the docker-compose setup. ```bash docker compose logs -f rauthy ``` -------------------------------- ### Initialize Theme and Sidebar Settings Source: https://github.com/sebadob/rauthy/blob/main/docs/config/argon2.html This script initializes theme and sidebar settings by reading from localStorage and applying them to the HTML document. It handles potential errors during localStorage access and sets default themes based on user's system preferences. ```javascript const path_to_root = "../"; const default_light_theme = "light"; const default_dark_theme = "navy"; try { let theme = localStorage.getItem('mdbook-theme'); let sidebar = localStorage.getItem('mdbook-sidebar'); if (theme.startsWith('"') && theme.endsWith('"')) { localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1)); } if (sidebar.startsWith('"') && sidebar.endsWith('"')) { localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1)); } } catch (e) { } const default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? default_dark_theme : default_light_theme; let theme; try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { } if (theme === null || theme === undefined) { theme = default_theme; } const html = document.documentElement; html.classList.remove('light') html.classList.add(theme); html.classList.add("js"); let sidebar = null; const sidebar_toggle = document.getElementById("sidebar-toggle-anchor"); if (document.body.clientWidth >= 1080) { try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { } sidebar = sidebar || 'visible'; } else { sidebar = 'hidden'; } sidebar_toggle.checked = sidebar === 'visible'; html.classList.remove('sidebar-visible'); html.classList.add("sidebar-" + sidebar); ``` -------------------------------- ### Enable Swagger UI Source: https://github.com/sebadob/rauthy/blob/main/docs/print.html Enable the Swagger UI by setting `swagger_ui_enable` to `true` in the `[server]` configuration section. This consumes additional memory. ```toml [server] # Can be set to `true` to enable the Swagger UI. # This will consume ~13mb of additional memory. # # default: false # overwritten by: SWAGGER_UI_ENABLE swagger_ui_enable = true ``` -------------------------------- ### Get Bootstrap Secret in JSON Format Source: https://github.com/sebadob/rauthy/blob/main/book/src/config/cli.md Retrieves a bootstrap-generated secret and preserves all fields in JSON format. This is useful for accessing structured secret data. ```bash rauthy bootstrap get \ --kind user \ --id admin@example.com \ --field password \ --format json ```