🚀 InitSatis
Initializes a new Satis repository: creates the directory and generates a basic satis.json configuration. It is a directory-aware wrapper around CreateSatisConfig.
When to use
Use this when you need to quickly scaffold a Satis private repository, completing directory creation and configuration file writing in one step.
Signature
go
func (c *Composer) InitSatis(name string, homepage string, dir string) errorParameters
| Parameter | Type | Description |
|---|---|---|
name | string | Repository name, e.g. my-company/composer |
homepage | string | Repository homepage URL |
dir | string | Target directory; pass an empty string to default to satis |
Return value
| Return value | Type | Description |
|---|---|---|
| Single return value | error | Returned when directory creation or configuration writing fails |
Default behavior
When dir is empty, satis is used as the directory; if the directory does not exist it is created automatically (permission 0755), and the configuration is written to <dir>/satis.json.
Example
go
package main
import (
"log"
"github.com/scagogogo/composer-skills/pkg/composer"
)
func main() {
comp, err := composer.New(composer.DefaultOptions())
if err != nil {
log.Fatalf("Initialization failed: %v", err)
}
if err := comp.InitSatis(
"my-company/composer",
"https://composer.example.com",
"satis",
); err != nil {
log.Fatalf("Satis init failed: %v", err)
}
}Advanced
- This method internally calls CreateSatisConfig to write the configuration.
- After initialization, use BuildSatis to generate the repository artifacts.
- For finer-grained control (custom paths, appending repositories), use CreateSatisConfig and
AddSatisRepositorydirectly.