-
Notifications
You must be signed in to change notification settings - Fork 176
Move orchestrator config into a model #1295
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
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
95bfcfb
move orchestrator config into a model
djeebus 52951ef
split network config from the rest
djeebus 775c9d6
fix some more types
djeebus 2e58f31
tidy, proof that cursor is wrong
djeebus 2f0e1f5
parse network config in build-template command
djeebus 118f424
Merge remote-tracking branch 'origin/main' into orchestrator-config
djeebus 2c41ca4
proxy port
djeebus 361991b
Merge branch 'main' into orchestrator-config
djeebus 805f176
Apply suggestion from @jakubno
jakubno 3d15ceb
Merge remote-tracking branch 'origin/main' into orchestrator-config
jakubno 8a6dfc9
Update test code to the config
jakubno 6209e35
Move after setting env
jakubno File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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,29 @@ | ||
package cfg | ||
|
||
import ( | ||
"github.com/caarlos0/env/v11" | ||
|
||
"github.com/e2b-dev/infra/packages/orchestrator/internal/sandbox/network" | ||
) | ||
|
||
type Config struct { | ||
AllowSandboxInternet bool `env:"ALLOW_SANDBOX_INTERNET" envDefault:"true"` | ||
ClickhouseConnectionString string `env:"CLICKHOUSE_CONNECTION_STRING"` | ||
ForceStop bool `env:"FORCE_STOP"` | ||
GRPCPort uint16 `env:"GRPC_PORT" envDefault:"5008"` | ||
LaunchDarklyAPIKey string `env:"LAUNCH_DARKLY_API_KEY"` | ||
OrchestratorBasePath string `env:"ORCHESTRATOR_BASE_PATH" envDefault:"/orchestrator"` | ||
OrchestratorLockPath string `env:"ORCHESTRATOR_LOCK_PATH" envDefault:"/orchestrator.lock"` | ||
ProxyPort uint16 `env:"PROXY_PORT" envDefault:"5007"` | ||
RedisClusterURL string `env:"REDIS_CLUSTER_URL"` | ||
RedisURL string `env:"REDIS_URL"` | ||
Services []string `env:"ORCHESTRATOR_SERVICES" envDefault:"orchestrator"` | ||
|
||
NetworkConfig network.Config | ||
cursor[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
func Parse() (Config, error) { | ||
var model Config | ||
err := env.Parse(&model) | ||
return model, err | ||
} |
This file contains hidden or 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,35 @@ | ||
package cfg | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestParse(t *testing.T) { | ||
t.Run("network config local flag defaults to false", func(t *testing.T) { | ||
config, err := Parse() | ||
require.NoError(t, err) | ||
|
||
assert.False(t, config.NetworkConfig.UseLocalNamespaceStorage) | ||
}) | ||
|
||
t.Run("network config is parsed correctly", func(t *testing.T) { | ||
t.Setenv("USE_LOCAL_NAMESPACE_STORAGE", "true") | ||
|
||
config, err := Parse() | ||
require.NoError(t, err) | ||
|
||
assert.True(t, config.NetworkConfig.UseLocalNamespaceStorage) | ||
}) | ||
|
||
t.Run("multiple services parses correctly", func(t *testing.T) { | ||
t.Setenv("ORCHESTRATOR_SERVICES", "service1,service2") | ||
|
||
config, err := Parse() | ||
require.NoError(t, err) | ||
|
||
assert.Equal(t, []string{"service1", "service2"}, config.Services) | ||
}) | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.