Skip to content

Commit

Permalink
Adjusts
Browse files Browse the repository at this point in the history
  • Loading branch information
sleipnir committed Sep 1, 2024
1 parent 7f6a4f9 commit ce2072f
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
3 changes: 2 additions & 1 deletion spawnctl/lib/spawnctl/commands/dev/run.ex
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ defmodule SpawnCtl.Commands.Dev.Run do
alias SpawnCtl.Util.Emoji
alias Testcontainers.Container

import SpawnCtl.Util, only: [is_valid?: 1, log: 3]
import SpawnCtl.Util, only: [generate: 0, is_valid?: 1, log: 3]

@default_opts %{
actor_system: "spawn-system",
Expand Down Expand Up @@ -340,6 +340,7 @@ defmodule SpawnCtl.Commands.Dev.Run do
Container.new(opts.proxy_image)
|> maybe_mount_proto_files(opts.protos)
|> Container.with_environment("MIX_ENV", "prod")
|> Container.with_environment("PROXY_APP_NAME", "proxy_#{generate()}")
|> Container.with_environment("PROXY_CLUSTER_STRATEGY", "gossip")
|> Container.with_environment("PROXY_DATABASE_TYPE", opts.database_type)
|> Container.with_environment("PROXY_DATABASE_PORT", "#{opts.database_port}")
Expand Down
30 changes: 30 additions & 0 deletions spawnctl/lib/spawnctl/util.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,36 @@ defmodule SpawnCtl.Util do

@extension_blacklist ~w(.swp .swx)

@adjectives ~w(
autumn hidden bitter misty silent empty dry dark summer
icy delicate quiet white cool spring winter patient
twilight dawn crimson wispy weathered blue billowing
broken cold damp falling frosty green long late lingering
bold little morning muddy old red rough still small
sparkling throbbing shy wandering withered wild black
young holy solitary fragrant aged snowy proud floral
restless divine polished ancient purple lively nameless
)

@nouns ~w(
waterfall river breeze moon rain wind sea morning
snow lake sunset pine shadow leaf dawn glitter forest
hill cloud meadow sun glade bird brook butterfly
bush dew dust field fire flower firefly feather grass
haze mountain night pond darkness snowflake silence
sound sky shape surf thunder violet water wildflower
wave water resonance sun wood dream cherry tree fog
frost voice paper frog smoke star hamster
)

def generate(max_id \\ 9999) do
adjective = @adjectives |> Enum.random()
noun = @nouns |> Enum.random()
id = :rand.uniform(max_id)

[adjective, noun, id] |> Enum.join("_")
end

def os_exec(cmd, args) when is_list(args), do: System.cmd(cmd, args)

def extract_tar_gz(file_path) do
Expand Down

0 comments on commit ce2072f

Please sign in to comment.