AppGini files to ignore in git repositories¶
If you plan to use a version control system like git to manage your AppGini application, you should ignore certain files and folders to avoid committing unnecessary/unsafe files to your repository.
But first, let's discuss the recommended way to set up your repository for an AppGini application. The instructions below assume you are using git as your version control system. Git is the most popular version control system and is widely used by developers around the world.
Recommended repository structure for AppGini applications¶
When you generate an AppGini application, you are asked to select the output folder for the generated files. When the application is generated inside that folder, it will create the following structure:
Where your-app-folder
is the folder you selected when generating the application.
We don't recommend creating (initializing) the git repository inside this folder.
The reason is that the repository data is stored in a .git
folder inside the repository root folder.
This folder might get uploaded to your server when you deploy your application, leading to exposing
your repository data to the public. This is a security risk.
Instead, we recommend setting the folder structure as follows before generating the application:
Then, generate the application inside the app
folder. This way, the repository root folder will be
your-app-folder
, and the .git
folder will be at the root level, not inside the application folder.
Your folder structure after generating the application will look like this:
After initializing the git repository in your-app-folder
using the command git init
, your
folder structure will look like this:
You can then safely upload the contents of the app
folder to your server, without exposing your
repository data.
Files and folders to ignore in your git repository¶
Some files and folders generated by AppGini are not meant to be committed to your repository. This is either because they are generated dynamically by your AppGini application, or because they contain sensitive information like database connection details.
To ignore these files and folders, you should create a .gitignore
file in the root of your repository
and add the following lines to it:
# ignore files containing sensitive information
app/config.php
app/config.bak.php
app/file-uploader.php
app/admin/backups
# ignore files generated dynamically by AppGini application
app/setup.md5
app/tmp
app/admin/tmp
app/plugins
# ignore user-uploaded files
app/images
!app/images/index.html
!app/images/blank.gif
# ignore other common artifacts
*.log
*.cache
*.zip
This will tell git to ignore the listed files and folders when committing changes to your repository.
TIP: Store your project file inside your repository¶
Another advantage of setting up your repository as described above is that you can store your AppGini
project file (the .axp
file) inside your repository. This way, you can easily keep track of changes
to your project file and revert to previous versions if needed.
To do this, simply copy your .axp
file to the root of your repository and commit it to your repository.
The folder structure of your repository will look like this:
your-app-folder/
.git/
app/
admin/
hooks/
images/
resources/
templates/
index.php
.. # other files
your-app.axp
Where your-app.axp
is your AppGini project file. Please note that in the above example, the project file
is stored in the root of the repository, outside the app
folder. This is recommended to avoid exposing
your project file to the public. The project file contains your entire database structure and settings,
so it's important to keep it secure.