Class GlobalConfig

java.lang.Object
cloud.kitelang.cli.config.GlobalConfig

public class GlobalConfig extends Object
Manages the global Kite configuration stored in ~/.kite/config.yml. Handles per-project, per-environment state backend configurations.
  • Method Details

    • getPasswordEnvVarName

      public static String getPasswordEnvVarName(String project, String environment)
      Gets the environment variable name for a given project/environment's password. Format: KITE__{PROJECT}__{ENVIRONMENT}__DB_PASSWORD Uses double underscores as separators to clearly delimit project/environment names.
    • load

      public static GlobalConfig load() throws IOException
      Loads or creates the global configuration.
      Throws:
      IOException
    • getConfigPath

      public static Path getConfigPath()
      Gets the default config path (~/.kite/config.yml).
    • getKiteDir

      public static Path getKiteDir()
      Gets the kite directory path (~/.kite).
    • save

      public void save() throws IOException
      Saves the configuration to disk.
      Throws:
      IOException
    • getStateConfig

      public GlobalConfig.StateConfig getStateConfig(String project, String environment)
      Gets the state configuration for a specific project and environment.
    • setStateConfig

      public void setStateConfig(String project, String environment, GlobalConfig.StateConfig stateConfig)
      Sets the state configuration for a specific project and environment.
    • getProjects

      public List<GlobalConfig.ProjectConfig> getProjects()
      Gets all configured projects.
    • getEnvironments

      public Map<String, GlobalConfig.EnvironmentConfig> getEnvironments(String project)
      Gets all configured environments for a project.
    • hasProject

      public boolean hasProject(String project)
      Checks if a project is configured.
    • hasEnvironment

      public boolean hasEnvironment(String project, String environment)
      Checks if an environment is configured for a project.
    • removeEnvironment

      public void removeEnvironment(String project, String environment)
      Removes an environment configuration from a project.
    • removeProject

      public void removeProject(String project)
      Removes an entire project configuration.
    • createPostgreSQLConfig

      public static GlobalConfig.StateConfig createPostgreSQLConfig(String url, String username, String password)
      Creates a PostgreSQL state configuration.
    • createKiteCloudConfig

      public static GlobalConfig.StateConfig createKiteCloudConfig()
      Creates a Kite Cloud state configuration.