Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(go-runtime): use new configuration/secret system #1013

Merged
merged 1 commit into from
Mar 4, 2024

Conversation

alecthomas
Copy link
Collaborator

@alecthomas alecthomas commented Mar 4, 2024

This allows secrets/config to be dynamically updated in most cases (the envar provider being a notable exception).

🐚 ~/dev/ftl $ ftl config set echo.default --inline "anonymous"
🐚 ~/dev/ftl $ ftl config get echo.default
"anonymous"
🐚 ~/dev/ftl $ ftl call echo.echo       aat/configuration-go-runtime
{"message":"Hello, anonymous!!! It is 2024-03-03 07:45:21.237088 +1000 AEST!"}
🐚 ~/dev/ftl $ ftl config set echo.default --inline "Anne"
🐚 ~/dev/ftl $ ftl config get echo.default
"Anne"
🐚 ~/dev/ftl $ ftl call echo.echo
{"message":"Hello, Anne!!! It is 2024-03-03 07:44:52.2176 +1000 AEST!"}

I also refactored the configuration package such that managers and providers are tied to their role by a type parameter.

Finally, I made a few tweaks to allow FTL to largely work offline:

  • Propagate replace directives from Go modules into the generated main and external-module go.mod files.
  • Add --[no-]console flag that allows building of the console to be skipped.
  • TODO: Figure out how put maven builds into offline mode

@alecthomas alecthomas force-pushed the aat/configuration-go-runtime branch 5 times, most recently from e5f0fe2 to 56dbfad Compare March 4, 2024 07:08
@@ -218,6 +219,7 @@ func (s *Service) Deploy(ctx context.Context, req *connect.Request[ftlv1.DeployR
ftlv1connect.NewVerbServiceClient,
plugin.WithEnvars(
"FTL_ENDPOINT="+s.config.ControllerEndpoint.String(),
"FTL_CONFIG="+filepath.Join(internal.GitRoot(""), "ftl-project.toml"),
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is hard coded to look in the git root for now. Once the runner/controller implements the second half of the config/secrets design, this will be less janky.

@alecthomas alecthomas force-pushed the aat/configuration-go-runtime branch from 56dbfad to 7ff82d6 Compare March 4, 2024 07:12
This allows secrets/config to be dynamically updated in most cases
(the envar provider being a notable exception).

```
🐚 ~/dev/ftl $ ftl config set echo.default --inline "anonymous"
🐚 ~/dev/ftl $ ftl config get echo.default
"anonymous"
🐚 ~/dev/ftl $ ftl call echo.echo       aat/configuration-go-runtime
{"message":"Hello, anonymous!!! It is 2024-03-03 07:45:21.237088 +1000 AEST!"}
🐚 ~/dev/ftl $ ftl config set echo.default --inline "Anne"
🐚 ~/dev/ftl $ ftl config get echo.default
"Anne"
🐚 ~/dev/ftl $ ftl call echo.echo
{"message":"Hello, Anne!!! It is 2024-03-03 07:44:52.2176 +1000 AEST!"}
```

Also made a few tweaks to allow FTL to largely work offline:

- Propagate `replace` directives from Go modules into the generated main
  and external-module `go.mod` files.
- Add `--[no-]console` flag that allows building of the console to be
  skipped.
- Put Bit maven builds into offline mode (does not work fully, I think
  there's another flag to force Maven to use the local repository that
  needs to be used, but I'm offline and there's nothing in `--help`).
@alecthomas alecthomas force-pushed the aat/configuration-go-runtime branch from 7ff82d6 to 1f63c29 Compare March 4, 2024 07:20
@alecthomas alecthomas marked this pull request as ready for review March 4, 2024 07:23
@alecthomas alecthomas merged commit a76730c into main Mar 4, 2024
11 checks passed
@alecthomas alecthomas deleted the aat/configuration-go-runtime branch March 4, 2024 07:23
@alecthomas alecthomas mentioned this pull request Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant