1

The config file syntax of Satis is almost like Composer's.

This example Satis config works for comparison:

{
    "name": "local/repository",
    "homepage": "http://localhost/",
    "repositories": [
        {
            "name": "doctrine/inflector",
            "type": "git",
            "url": "https://github.com/doctrine/inflector.git"
        },
        {
            "name": "laravel/laravel",            
            "type": "git",
            "url": "https://github.com/laravel/laravel.git"
        }
        
    ],
    "require-all": true,
    "archive": {
        "directory": "dist"
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true,
        "secure-http": false
    }
}

However what happens is that Satis downloads all the available versions from the specified GitHub repos. In this case all of Laravel's versions and all of Inflector's versions.

But I only want a single package - the latest version, from a downloaded zip file (The zip I downloaded from the remote package repository (GitHub)).

What could possibly be the correct configuration for a downloaded zip file instead of the current name/type/url combination inside the Satis repositories block?

Or, in order to use the downloaded zip file, I need to do something completely different?

I tried a few but all ended up with all sorts of errors

pileup
  • 1
  • 2
  • 18
  • 45
  • What is your actual aim here? If it's to have a local cache of the public packages you depend on, I think Satis may not be the right tool for the job. – IMSoP Aug 25 '22 at 23:20
  • 2
    And please refrain from posting the same question over and over again, if you specialized since the four hours of your first question, edit it to extend, don't extend with a second question. – hakre Aug 26 '22 at 04:28
  • @hakre, I managed to make it work the way I meant it, if you're interested look in my answer. Also, regarding the duplicate answer - I was sure I deleted it. I just made a badly asked question and made this instead, but forgot to delete the other. IMSoP I need to be able to use Composer from a local repository and not online due to security issues, and I can only get one version at a time – pileup Aug 26 '22 at 08:04

1 Answers1

0

Ok, I found the correct syntax to make Satis configure single zip files. In the following example I used both full git repository that I fetched online and one single zip file from my local machine:

{
    "name": "local/repository",
    "homepage": "http://localhost/",
    "repositories": [            
        {
            "type": "package",
            "package": {
                "name": "doctrine/inflector",
                "version": "2.0.4",
                "dist": {
                    "url": "C:/path/to/zip_files/inflector.zip",
                    "type": "zip"
                }
            }
        },
        {
            "name": "laravel/laravel",            
            "type": "git",
            "url": "https://github.com/laravel/laravel.git"
        }
        
    ],
    "require-all": true,
    "archive": {
        "directory": "dist"
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true,
        "secure-http": false
    }
}
pileup
  • 1
  • 2
  • 18
  • 45
  • 1
    Okay, then I really didn't get your question sorry. A pointer to the docs might be the composer repository configuration: https://getcomposer.org/doc/05-repositories.md - no idea what your requirement for Satis actually is still thought. You're aware of the global composer configuration file, right? – hakre Aug 26 '22 at 13:49
  • @hakre - where I work, they blocked outbound/inbound traffic and they only allow me to get individual packages downloaded from GitHub after they've been scanned. So I need to be able to use `composer` commands so that it configures everything properly (Manually configuring my project's composer files is a nightmare, or actually impossible). Btw, what do you mean by global composer configuration file - I know about it, but where does it go in this case and what should I be aware of? – pileup Aug 26 '22 at 21:32
  • 1
    In the global configuration file you can configure repositories as well. It's then that you don't need to do that within the projects individually. E.g. you could configure to use the Satis by default or even packages on the hosts file-system directly which comes with some benefits when installing (e.g. symlinking is possible or local git clones). It is also that you don't need to run some extra service. – hakre Aug 27 '22 at 09:02
  • Oh that's a good idea to define the satis repository in the global config. Good idea. I did that, or so I think. I found a `composer.json` in the ROAMING directory, but it was an empty json file. So where things like Packagist is defined as the default repo in the first place? Is this `composer.json` the global config or I'm wrong? – pileup Aug 27 '22 at 12:04
  • `composer config home` shows it, look inside there you find a `config.json` there, keep backups (or use the CLI interface for changes) ;) - compare https://getcomposer.org/doc/06-config.md (see `--global`), https://getcomposer.org/doc/03-cli.md#config and https://getcomposer.org/doc/05-repositories.md etc. – hakre Aug 27 '22 at 12:46
  • Oh yes I already found that but the `config.json` file there was empty. However when I use `composer config --list --global`, it shows me a long list of already defined Composer properties, such as `secure-http`, `cache-ttl`, `discard-changes` and many more. But the file `config.json` itself is empty. So I guess Composer has a list of default properties defined somewhere in the `phar` file upon installation? – pileup Aug 27 '22 at 16:23
  • Default values those are. Check the manual and if in doubt, as you must have the composer package already reviewed -- otherwise you could not execute the application -- check the source, its available. E.g. the config object. - And don't forget to highlight in your answer what the actual fix was as otherwise it is not that useful for your future self and other future visitors. – hakre Aug 27 '22 at 16:58