-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automate sites.yaml config #81
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels a bit manual, maybel we can add some magic to do it on the fly, but this is just food for thought.
src/Commands/CreateSites.php
Outdated
} | ||
|
||
Site::setSites($sites); | ||
Site::save(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we're getting this from the database anyway, can't we maybe just overwrite the getSavedSites
function in Statamic\Sites\Sites
to just return a cached array with the queries already done? Then we set the sites on the fly and we can get rid of the sites.yaml all together 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes i agree, i feel like this might be the best way to go.
I cached the sites array for now because of the setStore() function which is needed to get the correct site data.
After rapidez/core#567 gets merged we can use getValue() function without having to do the setStore().
Co-authored-by: Roy Duineveld <[email protected]>
I think we should wait with merging so we can release it in bulk along with the Hybrid runway changes. |
README.md
Outdated
It will mainly setup the [Eloquent driver](https://github.com/statamic/eloquent-driver) and publish the necessary vendor from the rapidez/statamic repo. | ||
It will mainly setup the [Eloquent driver](https://github.com/statamic/eloquent-driver) and publish the necessary vendor from the rapidez/statamic repo. | ||
|
||
Before running the install script, make sure you have an existing User model as Statamic requires this. See: [Statamic docs](https://statamic.dev/tips/storing-users-in-a-database) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't explain how you should get you user model back: https://github.com/laravel/laravel/blob/11.x/app/Models/User.php, as we don't provide it from rapidez/rapidez
: https://github.com/rapidez/rapidez/blob/040ada124619473f7d713aab537d82cea51f0026/.github/workflows/copy-laravel-source.yml#L45. You'll also need the migrations, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed the readme with a clearer explanation for how and what with the user model!
Moved most of the configuration guide to the Rapidez docs (rapidez/docs#56). |
config/rapidez/statamic.php
Outdated
'locale' => 'en_EN', | ||
'lang' => 'en_EN', | ||
'url' => '/', | ||
'attributes' => [ | ||
'magento_store_id' => 1, | ||
'group' => 'default', | ||
'disabled' => false, | ||
], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need this whole sites config?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed this around, see #81 (comment)
$configModel = config('rapidez.models.config'); | ||
|
||
foreach ($stores as $store) { | ||
if (config('rapidez.statamic.sites.' . $store['code'] . '.attributes.disabled')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we safely say we always want this to be enabled? And otherwise maybe just have an array that includes the disabled stores?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed this around, see #81 (comment)
We can merge this in my opinion, what about yours @royduin |
We've a conflict but besides that I'm also curious about the answers on your latest questions. It's currently unclear where the |
Conflict has been fixed! |
We can automate the generation of the new sites.yaml.
By doing this we reduce the amount of config needed to configure the sites, only keeping a few settings in the sites array of
config/rapidez/statamic.php
.Not sure yet if setting this during boot is the way to go, could also generate it through a command when setting up the site.
Let me know what you would prefer!