lifedebugger commited on
Commit
a3453c9
·
1 Parent(s): bbb7c16

Deploy files from GitHub repository

Browse files
.github/workflows/test.yml ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Deploy to Huggingface
2
+ on:
3
+ push:
4
+ branches:
5
+ - tests
6
+ jobs:
7
+ deploy-to-huggingface:
8
+ runs-on: ubuntu-latest
9
+ steps:
10
+ # Checkout repository
11
+ - name: Checkout Repository
12
+ uses: actions/checkout@v3
13
+ # Setup Git
14
+ - name: Setup Git for Huggingface
15
+ run: |
16
+ git config --global user.email "abdan.hafidz@gmail.com"
17
+ git config --global user.name "abdanhafidz"
18
+ # Clone Huggingface Space Repository
19
+ - name: Clone Huggingface Space
20
+ env:
21
+ HF_TOKEN: ${{ secrets.HF_TOKEN }}
22
+ run: |
23
+ git clone https://huggingface.co/spaces/lifedebugger/quzuu-api-test space
24
+ # Update Git Remote URL and Pull Latest Changes
25
+ - name: Update Remote and Pull Changes
26
+ env:
27
+ HF_TOKEN: ${{ secrets.HF_TOKEN }}
28
+ run: |
29
+ cd space
30
+ git remote set-url origin https://lifedebugger:$HF_TOKEN@huggingface.co/spaces/lifedebugger/quzuu-api-test
31
+ git pull origin main || echo "No changes to pull"
32
+ # Clean Space Directory - Delete all files except .git
33
+ - name: Clean Space Directory
34
+ run: |
35
+ cd space
36
+ find . -mindepth 1 -not -path "./.git*" -delete
37
+ # Copy Files to Huggingface Space
38
+ - name: Copy Files to Space
39
+ run: |
40
+ rsync -av --exclude='.git' ./ space/
41
+ # Commit and Push to Huggingface Space
42
+ - name: Commit and Push to Huggingface
43
+ env:
44
+ HF_TOKEN: ${{ secrets.HF_TOKEN }}
45
+ run: |
46
+ cd space
47
+ git add .
48
+ git commit -m "Deploy files from GitHub repository" || echo "No changes to commit"
49
+ git push origin main || echo "No changes to push"
provider/config_provider.go CHANGED
@@ -1,39 +1,39 @@
1
- package provider
2
-
3
- import "abdanhafidz.com/go-boilerplate/config"
4
-
5
- type ConfigProvider interface {
6
- ProvideJWTConfig() config.JWTConfig
7
- ProvideEnvConfig() config.EnvConfig
8
- ProvideDatabaseConfig() config.DatabaseConfig
9
- }
10
-
11
- type configProvider struct {
12
- jWTConfig config.JWTConfig
13
- envConfig config.EnvConfig
14
- databaseConfig config.DatabaseConfig
15
- }
16
-
17
- func NewConfigProvider() ConfigProvider {
18
-
19
- envConfig := config.NewEnvConfig("Asia/Jakarta")
20
- jWTConfig := config.NewJWTConfig(envConfig.GetSalt())
21
- databaseConfig := config.NewDatabaseConfig(envConfig.GetDatabaseHost(), envConfig.GetDatabaseUser(), envConfig.GetDatabasePassword(), envConfig.GetDatabaseName(), envConfig.GetDatabasePort())
22
- return &configProvider{
23
- jWTConfig: jWTConfig,
24
- envConfig: envConfig,
25
- databaseConfig: databaseConfig,
26
- }
27
- }
28
-
29
- func (c *configProvider) ProvideJWTConfig() config.JWTConfig {
30
- return c.jWTConfig
31
- }
32
-
33
- func (c *configProvider) ProvideEnvConfig() config.EnvConfig {
34
- return c.envConfig
35
- }
36
-
37
- func (c *configProvider) ProvideDatabaseConfig() config.DatabaseConfig {
38
- return c.databaseConfig
39
- }
 
1
+ package provider
2
+
3
+ import "abdanhafidz.com/go-clean-layered-architecture/config"
4
+
5
+ type ConfigProvider interface {
6
+ ProvideJWTConfig() config.JWTConfig
7
+ ProvideEnvConfig() config.EnvConfig
8
+ ProvideDatabaseConfig() config.DatabaseConfig
9
+ }
10
+
11
+ type configProvider struct {
12
+ jWTConfig config.JWTConfig
13
+ envConfig config.EnvConfig
14
+ databaseConfig config.DatabaseConfig
15
+ }
16
+
17
+ func NewConfigProvider() ConfigProvider {
18
+
19
+ envConfig := config.NewEnvConfig("Asia/Jakarta")
20
+ jWTConfig := config.NewJWTConfig(envConfig.GetSalt())
21
+ databaseConfig := config.NewDatabaseConfig(envConfig.GetDatabaseHost(), envConfig.GetDatabaseUser(), envConfig.GetDatabasePassword(), envConfig.GetDatabaseName(), envConfig.GetDatabasePort())
22
+ return &configProvider{
23
+ jWTConfig: jWTConfig,
24
+ envConfig: envConfig,
25
+ databaseConfig: databaseConfig,
26
+ }
27
+ }
28
+
29
+ func (c *configProvider) ProvideJWTConfig() config.JWTConfig {
30
+ return c.jWTConfig
31
+ }
32
+
33
+ func (c *configProvider) ProvideEnvConfig() config.EnvConfig {
34
+ return c.envConfig
35
+ }
36
+
37
+ func (c *configProvider) ProvideDatabaseConfig() config.DatabaseConfig {
38
+ return c.databaseConfig
39
+ }