-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 changed file
with
40 additions
and
0 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,40 @@ | ||
# ftl | ||
Configuration management in plain Go code. | ||
|
||
**This is an early draft. Proceed with caution.** | ||
|
||
With FTL you write Go programs that use a combination of `ftl`, `ftl/ops`, `ftl/log` and third-party libraries to update system state. | ||
|
||
The `ftl` CLI copies and runs the plan on the destination host. | ||
|
||
## Example | ||
|
||
``` | ||
$ cat examples/tools/main.go | ||
package main | ||
import ( | ||
"github.com/ftlops/ftl" | ||
"github.com/ftlops/ftl/ops" | ||
) | ||
func main() { | ||
ftl.Step("install tools", func() ftl.State { | ||
missing := ops.MissingPackages("gnupg", "tree", "htop") | ||
if len(missing) == 0 { | ||
return ftl.StateUnchanged | ||
} | ||
ops.UpdateRepos() | ||
ops.Install(missing...) | ||
return ftl.StateChanged | ||
}) | ||
} | ||
$ ftl [email protected] examples/tools | ||
2021/04/06 00:01:29 ((( [install tools] | ||
2021/04/06 00:01:29 DBG [install tools] ops.UpdateRepos | ||
2021/04/06 00:01:32 DBG [install tools] ops.Install: tree | ||
2021/04/06 00:01:35 ))) [install tools] -> changed | ||
$ ftl [email protected] examples/tools | ||
2021/04/06 00:02:36 ((( [install tools] | ||
2021/04/06 00:02:36 ))) [install tools] -> unchanged | ||
``` |