Skip to content

Commit e25e0c7

Browse files
[Hotfix] Update injection and config formats and fixed github workflow permissions.
1 parent c4b7b3c commit e25e0c7

File tree

15 files changed

+103
-50
lines changed

15 files changed

+103
-50
lines changed

.github/workflows/create-release.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ on:
1414
required: true
1515
default: false
1616

17+
permissions:
18+
contents: write
19+
1720
env:
1821
ALLOW_PRERELEASE: ${{ startsWith(github.ref, 'refs/heads/develop') || startsWith(github.ref, 'refs/heads/hotfix/') }}
1922

.github/workflows/format.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ on:
1414
- main
1515
- develop
1616

17+
permissions:
18+
contents: write
19+
1720
env:
1821
DOTNET_VERSION: "9.0.x"
1922

.github/workflows/issue-branch.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ on:
1212
pull_request:
1313
types: [ opened, closed ]
1414

15+
permissions:
16+
issues: write
17+
pull-requests: write
18+
1519
jobs:
1620
create_issue_branch_job:
1721
runs-on: ubuntu-latest

.github/workflows/publish.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ env:
1414
BUILD_CONFIGURATION: ''
1515
VERSION_SUFFIX: ''
1616

17+
permissions:
18+
contents: write
19+
packages: write
20+
actions: read
21+
1722
jobs:
1823
build-publish:
1924
runs-on: ubuntu-latest

.github/workflows/test.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ on:
1414
- main
1515
- develop
1616

17+
permissions:
18+
contents: read
19+
actions: read
20+
1721
env:
1822
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
1923
SOLUTION_NAME: ${{ vars.SOLUTION_NAME }}

.github/workflows/unlist-nuget.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ on:
88
env:
99
BRANCH_NAME: ${{ github.event.release.target_commitish }}
1010
PROJECT_NAME: ${{ vars.PROJECT_NAME }}
11-
11+
12+
permissions:
13+
contents: write
14+
1215
jobs:
1316
publish:
1417
name: unlist on nuget

.github/workflows/update-version.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ on:
1313
required: true
1414
default: 'patch'
1515

16+
permissions:
17+
contents: write
18+
actions: read
19+
1620
env:
1721
ALLOW_UPDATES: ${{ startsWith(github.ref, 'refs/heads/develop') || startsWith(github.ref, 'refs/heads/hotfix/') }}
1822

Directory.Build.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
<!-- Solution version numbers -->
33
<PropertyGroup>
44
<MajorVersion>1</MajorVersion>
5-
<MinorVersion>2</MinorVersion>
6-
<PatchVersion>3</PatchVersion>
5+
<MinorVersion>3</MinorVersion>
6+
<PatchVersion>0</PatchVersion>
77
<RevisionVersion>0</RevisionVersion>
88
<VersionPrefix>$(MajorVersion).$(MinorVersion).$(PatchVersion)</VersionPrefix>
99
<FileVersion>$(MajorVersion).$(MinorVersion).$(PatchVersion).$(RevisionVersion)</FileVersion>

Hyperbee.XS.sln

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,14 @@ EndProject
1717
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{4DBDB7F5-3F66-4572-80B5-3322449C77A4}"
1818
ProjectSection(SolutionItems) = preProject
1919
.github\workflows\create-release.yml = .github\workflows\create-release.yml
20+
.github\workflows\deploy-gh-pages.yml = .github\workflows\deploy-gh-pages.yml
2021
.github\workflows\format.yml = .github\workflows\format.yml
2122
.github\workflows\issue-branch.yml = .github\workflows\issue-branch.yml
2223
.github\workflows\publish.yml = .github\workflows\publish.yml
2324
.github\workflows\test-report.yml = .github\workflows\test-report.yml
2425
.github\workflows\test.yml = .github\workflows\test.yml
26+
.github\workflows\unlist-nuget.yml = .github\workflows\unlist-nuget.yml
27+
.github\workflows\update-version.yml = .github\workflows\update-version.yml
2528
EndProjectSection
2629
EndProject
2730
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "docs", "docs\docs.shproj", "{FC3B0A95-4DA0-43A0-A19D-624152BDF2F6}"

src/Hyperbee.XS.Extensions/ConfigurationParseExtension.cs

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
using System.Linq.Expressions;
2-
using Hyperbee.Collections;
32
using Hyperbee.Expressions;
4-
using Hyperbee.XS;
53
using Hyperbee.XS.Core;
64
using Hyperbee.XS.Core.Parsers;
75
using Hyperbee.XS.Core.Writer;
@@ -17,22 +15,27 @@ public class ConfigurationParseExtension : IParseExtension, IExpressionWriter, I
1715

1816
public Parser<Expression> CreateParser( ExtensionBinder binder )
1917
{
20-
return Between(
21-
Terms.Char( '<' ),
22-
XsParsers.TypeRuntime(),
23-
Terms.Char( '>' )
24-
)
25-
.And(
18+
// var mongo = config::connections.mongo;
19+
// var isSecure = config<bool>::connections.sql.secure;
20+
21+
return ZeroOrOne(
2622
Between(
27-
Terms.Char( '(' ),
28-
ZeroOrOne( Terms.String( StringLiteralQuotes.Double ) ),
29-
Terms.Char( ')' )
23+
Terms.Char( '<' ),
24+
XsParsers.TypeRuntime(),
25+
Terms.Char( '>' )
3026
)
3127
)
28+
.AndSkip( Terms.Text( "::" ) )
29+
.And( Terms.NamespaceIdentifier() )
3230
.Then<Expression>( static ( _, parts ) =>
3331
{
3432
var (type, key) = parts;
35-
return ExpressionExtensions.ConfigurationValue( type, key.ToString() );
33+
34+
if ( key == null )
35+
throw new InvalidOperationException( "Key must be specified." );
36+
37+
var configKey = key.ToString()!.Replace( '.', ':' );
38+
return ExpressionExtensions.ConfigurationValue( type ?? typeof( string ), configKey );
3639
}
3740
)
3841
.Named( "config" );
@@ -72,13 +75,8 @@ public void WriteExpression( Expression node, XsWriterContext context )
7275

7376
if ( configurationExpression.Key != null )
7477
{
75-
writer.Write( "(" );
76-
writer.Write( $"\"{configurationExpression.Key}\"" );
77-
writer.Write( ")" );
78-
}
79-
else
80-
{
81-
writer.Write( "()" );
78+
writer.Write( "::" );
79+
writer.Write( configurationExpression.Key.Replace( ':', '.' ) );
8280
}
8381
}
8482
}

0 commit comments

Comments
 (0)