Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
196 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: pip | ||
directory: "/" | ||
schedule: | ||
interval: daily | ||
time: "08:00" | ||
open-pull-requests-limit: 10 | ||
ignore: | ||
- dependency-name: mkdocs-material | ||
versions: | ||
- 6.2.6 | ||
- 6.2.7 | ||
- 6.2.8 | ||
- 7.0.0 | ||
- 7.0.1 | ||
- 7.0.2 | ||
- 7.0.3 | ||
- 7.0.7 | ||
- 7.1.0 | ||
- 7.1.1 | ||
- 7.1.2 | ||
- dependency-name: pymdown-extensions | ||
versions: | ||
- 8.1.1 | ||
- dependency-name: mkdocs-git-revision-date-localized-plugin | ||
versions: | ||
- "0.8" | ||
- dependency-name: mkdocs-versioning | ||
versions: | ||
- 0.4.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from dynaconf import Dynaconf | ||
from typing import Optional | ||
from fastapi import FastAPI | ||
|
||
settings = Dynaconf( | ||
settings_file="config.toml", # location of config file | ||
environments=["ansible", "puppet"], # available modes/environments | ||
envvar_prefix="TEFLO", # prefix for exporting env vars | ||
env_switcher="TEFLO_MODE", # Variable that controls mode switch | ||
env="ANSIBLE", # Initial env/mode | ||
) | ||
|
||
app = FastAPI() | ||
|
||
@app.get("/settings") | ||
def read_root(): | ||
return settings | ||
|
||
@app.get("/settings/{setting_name}") | ||
def read_item(setting_name: str): | ||
return {setting_name: settings.setting_name} | ||
|
||
if settings.current_env == "ANSIBLE": # this is the initial default | ||
assert settings.data_folder == "ansible/.teflo" | ||
|
||
if settings.current_env == "PUPPET": # only when TEFLO_MODE=puppet | ||
assert settings.data_folder == "puppet/.teflo" | ||
|
||
assert settings.log_level == "info" # might be exported TEFLO_DEBUG_MODE | ||
|
||
assert settings.workspace == "." | ||
|
||
print(settings.data_folder) | ||
print(settings["log_remove"]) | ||
print(settings.get("verbosity")) | ||
print(settings.LOG_LEVEL) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[default] | ||
log_level = "info" | ||
workspace= "." | ||
data_folder= ".teflo" | ||
|
||
[ansible] | ||
data_folder = "ansible/.teflo" | ||
log_remove = true | ||
verbosity = "v" | ||
|
||
[puppet] | ||
data_folder = "puppet/.teflo" | ||
log_remove = false | ||
verbosity = "vvv" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[tox] | ||
envlist = py36,py37,py38 | ||
envlist = py36,py37,py38,py39 | ||
whitelist_externals=make | ||
|
||
[testenv] | ||
|