nebu 0.1.24__py3-none-any.whl → 0.1.29__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
nebu/config.py CHANGED
@@ -32,7 +32,7 @@ class GlobalConfig:
32
32
  @classmethod
33
33
  def read(cls) -> GlobalConfig:
34
34
  """
35
- Read the config from ~/.agentsea/nebu.yaml, or create a default if it doesnt exist.
35
+ Read the config from ~/.agentsea/nebu.yaml, or create a default if it doesn't exist.
36
36
  Then ensure that we either find or create a matching server from environment variables,
37
37
  and set that as the `current_server` if relevant (mimicking the Rust logic).
38
38
  """
@@ -78,7 +78,7 @@ class GlobalConfig:
78
78
  # Ensure it has a name, so we can set current_server to it
79
79
  if found_server.name is None:
80
80
  found_server.name = server_name
81
- # Use that servers name as current
81
+ # Use that server's name as current
82
82
  config.current_server = found_server.name
83
83
  else:
84
84
  # Create a new server entry
@@ -133,3 +133,39 @@ def _get_config_file_path() -> str:
133
133
  home = os.path.expanduser("~")
134
134
  config_dir = os.path.join(home, ".agentsea")
135
135
  return os.path.join(config_dir, "nebu.yaml")
136
+
137
+
138
+ @dataclass
139
+ class ContainerConfig:
140
+ """
141
+ Configuration loaded from environment variables inside the container.
142
+ """
143
+
144
+ api_key: Optional[str] = None
145
+ server: Optional[str] = None
146
+ namespace: Optional[str] = None
147
+ name: Optional[str] = None
148
+ container_id: Optional[str] = None
149
+ date: Optional[str] = None
150
+ hf_home: Optional[str] = None
151
+ namespace_volume_uri: Optional[str] = None
152
+ name_volume_uri: Optional[str] = None
153
+ ts_authkey: Optional[str] = None
154
+
155
+ @classmethod
156
+ def from_env(cls) -> ContainerConfig:
157
+ """
158
+ Load configuration from environment variables.
159
+ """
160
+ return cls(
161
+ api_key=os.environ.get("NEBU_API_KEY"),
162
+ server=os.environ.get("NEBU_SERVER"),
163
+ namespace=os.environ.get("NEBU_NAMESPACE"),
164
+ name=os.environ.get("NEBU_NAME"),
165
+ container_id=os.environ.get("NEBU_CONTAINER_ID"),
166
+ date=os.environ.get("NEBU_DATE"),
167
+ hf_home=os.environ.get("HF_HOME"),
168
+ namespace_volume_uri=os.environ.get("NAMESPACE_VOLUME_URI"),
169
+ name_volume_uri=os.environ.get("NAME_VOLUME_URI"),
170
+ ts_authkey=os.environ.get("TS_AUTHKEY"),
171
+ )