mirror of
https://github.com/OMGeeky/confique.git
synced 2026-01-06 19:49:38 +01:00
Do major refactor of format code
This gets rid of a lot of duplicated logic that was previously copy&pasted. This commit alos: - Makes it easier to implement new formats - Gets rid of a few bugs - Makes the system more flexible (more options) - Adds a lot of additional tests
This commit is contained in:
@@ -5,7 +5,6 @@
|
||||
# Required! This value must be specified.
|
||||
#site_name =
|
||||
|
||||
|
||||
# Configurations related to the HTTP communication.
|
||||
[http]
|
||||
# The port the server will listen on.
|
||||
@@ -21,7 +20,6 @@
|
||||
# Default value: "127.0.0.1"
|
||||
#bind = "127.0.0.1"
|
||||
|
||||
|
||||
[http.headers]
|
||||
# The header in which the reverse proxy specifies the username.
|
||||
#
|
||||
@@ -33,7 +31,6 @@
|
||||
# Default value: "x-display-name"
|
||||
#display_name = "x-display-name"
|
||||
|
||||
|
||||
# Configuring the logging.
|
||||
[log]
|
||||
# If set to `true`, the app will log to stdout.
|
||||
|
||||
@@ -14,6 +14,12 @@ http:
|
||||
# Required! This value must be specified.
|
||||
#port:
|
||||
|
||||
# The bind address of the server. Can be set to `0.0.0.0` for example, to
|
||||
# allow other users of the network to access the server.
|
||||
#
|
||||
# Default value: 127.0.0.1
|
||||
#bind: 127.0.0.1
|
||||
|
||||
headers:
|
||||
# The header in which the reverse proxy specifies the username.
|
||||
#
|
||||
@@ -25,12 +31,6 @@ http:
|
||||
# Default value: x-display-name
|
||||
#display_name: x-display-name
|
||||
|
||||
# The bind address of the server. Can be set to `0.0.0.0` for example, to
|
||||
# allow other users of the network to access the server.
|
||||
#
|
||||
# Default value: 127.0.0.1
|
||||
#bind: 127.0.0.1
|
||||
|
||||
# Configuring the logging.
|
||||
log:
|
||||
# If set to `true`, the app will log to stdout.
|
||||
|
||||
43
tests/format-output/1-indent-2.toml
Normal file
43
tests/format-output/1-indent-2.toml
Normal file
@@ -0,0 +1,43 @@
|
||||
# A sample configuration for our app.
|
||||
|
||||
# Name of the website.
|
||||
#
|
||||
# Required! This value must be specified.
|
||||
#site_name =
|
||||
|
||||
# Configurations related to the HTTP communication.
|
||||
[http]
|
||||
# The port the server will listen on.
|
||||
#
|
||||
# Can also be specified via environment variable `PORT`.
|
||||
#
|
||||
# Required! This value must be specified.
|
||||
#port =
|
||||
|
||||
# The bind address of the server. Can be set to `0.0.0.0` for example, to
|
||||
# allow other users of the network to access the server.
|
||||
#
|
||||
# Default value: "127.0.0.1"
|
||||
#bind = "127.0.0.1"
|
||||
|
||||
[http.headers]
|
||||
# The header in which the reverse proxy specifies the username.
|
||||
#
|
||||
# Default value: "x-username"
|
||||
#username = "x-username"
|
||||
|
||||
# The header in which the reverse proxy specifies the display name.
|
||||
#
|
||||
# Default value: "x-display-name"
|
||||
#display_name = "x-display-name"
|
||||
|
||||
# Configuring the logging.
|
||||
[log]
|
||||
# If set to `true`, the app will log to stdout.
|
||||
#
|
||||
# Default value: true
|
||||
#stdout = true
|
||||
|
||||
# If this is set, the app will write logs to the given file. Of course,
|
||||
# the app has to have write access to that file.
|
||||
#file =
|
||||
46
tests/format-output/1-nested-gap-2.toml
Normal file
46
tests/format-output/1-nested-gap-2.toml
Normal file
@@ -0,0 +1,46 @@
|
||||
# A sample configuration for our app.
|
||||
|
||||
# Name of the website.
|
||||
#
|
||||
# Required! This value must be specified.
|
||||
#site_name =
|
||||
|
||||
|
||||
# Configurations related to the HTTP communication.
|
||||
[http]
|
||||
# The port the server will listen on.
|
||||
#
|
||||
# Can also be specified via environment variable `PORT`.
|
||||
#
|
||||
# Required! This value must be specified.
|
||||
#port =
|
||||
|
||||
# The bind address of the server. Can be set to `0.0.0.0` for example, to
|
||||
# allow other users of the network to access the server.
|
||||
#
|
||||
# Default value: "127.0.0.1"
|
||||
#bind = "127.0.0.1"
|
||||
|
||||
|
||||
[http.headers]
|
||||
# The header in which the reverse proxy specifies the username.
|
||||
#
|
||||
# Default value: "x-username"
|
||||
#username = "x-username"
|
||||
|
||||
# The header in which the reverse proxy specifies the display name.
|
||||
#
|
||||
# Default value: "x-display-name"
|
||||
#display_name = "x-display-name"
|
||||
|
||||
|
||||
# Configuring the logging.
|
||||
[log]
|
||||
# If set to `true`, the app will log to stdout.
|
||||
#
|
||||
# Default value: true
|
||||
#stdout = true
|
||||
|
||||
# If this is set, the app will write logs to the given file. Of course,
|
||||
# the app has to have write access to that file.
|
||||
#file =
|
||||
@@ -1,10 +1,13 @@
|
||||
#site_name:
|
||||
|
||||
http:
|
||||
#port:
|
||||
#bind: 127.0.0.1
|
||||
|
||||
headers:
|
||||
#username: x-username
|
||||
#display_name: x-display-name
|
||||
#bind: 127.0.0.1
|
||||
|
||||
log:
|
||||
#stdout: true
|
||||
#file:
|
||||
|
||||
23
tests/format-output/2-default.toml
Normal file
23
tests/format-output/2-default.toml
Normal file
@@ -0,0 +1,23 @@
|
||||
# A sample configuration for our app.
|
||||
|
||||
[http]
|
||||
[http.headers]
|
||||
# The header in which the reverse proxy specifies the username.
|
||||
#
|
||||
# Default value: "x-username"
|
||||
#username = "x-username"
|
||||
|
||||
# The header in which the reverse proxy specifies the display name.
|
||||
#
|
||||
# Default value: "x-display-name"
|
||||
#display_name = "x-display-name"
|
||||
|
||||
[http.log]
|
||||
# If set to `true`, the app will log to stdout.
|
||||
#
|
||||
# Default value: true
|
||||
#stdout = true
|
||||
|
||||
# If this is set, the app will write logs to the given file. Of course,
|
||||
# the app has to have write access to that file.
|
||||
#file =
|
||||
23
tests/format-output/2-default.yaml
Normal file
23
tests/format-output/2-default.yaml
Normal file
@@ -0,0 +1,23 @@
|
||||
# A sample configuration for our app.
|
||||
|
||||
http:
|
||||
headers:
|
||||
# The header in which the reverse proxy specifies the username.
|
||||
#
|
||||
# Default value: x-username
|
||||
#username: x-username
|
||||
|
||||
# The header in which the reverse proxy specifies the display name.
|
||||
#
|
||||
# Default value: x-display-name
|
||||
#display_name: x-display-name
|
||||
|
||||
log:
|
||||
# If set to `true`, the app will log to stdout.
|
||||
#
|
||||
# Default value: true
|
||||
#stdout: true
|
||||
|
||||
# If this is set, the app will write logs to the given file. Of course,
|
||||
# the app has to have write access to that file.
|
||||
#file:
|
||||
Reference in New Issue
Block a user