Skip to content

Commit

Permalink
Improve configurability BBE
Browse files Browse the repository at this point in the history
  • Loading branch information
HindujaB committed Oct 7, 2024
1 parent 6016b78 commit ff64dff
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
7 changes: 7 additions & 0 deletions examples/configurable-variables/configurable_variables.bal
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import ballerina/io;

// The host of the database server. The default value is `localhost`.
configurable string dbHost = "localhost";

// This specifies that the password must be supplied in a configuration file.
configurable string password = ?;

public function main() {
io:println("host: ", hostName);
io:println("password: ", password);
}
4 changes: 4 additions & 0 deletions examples/configurable-variables/configurable_variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@ For more information, see [Configure a sample Ballerina service](/learn/configur

::: code configurable_variables.bal :::

To run the example, copy the following content to a file named `Config.toml` in the current directory.

::: code Config.toml :::

::: out configurable_variables.out :::
2 changes: 2 additions & 0 deletions examples/configurable-variables/configurable_variables.out
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
$ bal run configurable_variables.bal
host: localhost
password: password
4 changes: 4 additions & 0 deletions examples/configuring-via-toml/configuring-via-toml.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@ For more information, see [Configure via TOML syntax](/learn/provide-values-to-c

::: code configuring_via_toml.bal :::

To run the example, copy the following content to a file named `Config.toml` in the current directory.

::: code Config.toml :::

::: out configuring_via_toml.out :::

0 comments on commit ff64dff

Please sign in to comment.